dbt-labs / dbt-adapters

Apache License 2.0
17 stars 20 forks source link

Avoid false positives in `date_spine` macro #211

Open dbeatty10 opened 2 months ago

dbeatty10 commented 2 months ago

resolves https://github.com/dbt-labs/dbt-adapters/issues/210 resolves https://github.com/dbt-labs/dbt-adapters/issues/208

Problem

While working on https://github.com/dbt-labs/dbt-core/issues/10075, I noticed a few things about this test case:

  1. The date range is larger than needed
  2. The test can give a false positives
  3. There are hard-coded adapter types

The second one is the most impactful. This PR solves the first two.

Solution

  1. Reduce the date range from 9 down to 3 (which gets rid of 36 lines of code)
  2. Use a full outer join rather than a left join to eliminate possibility of a false positive

Checklist