Skip to content

Commit 53f8352

Browse files
Add upper_bound_column to order by (#660)
* Add upper_bound_column to order by * Update CHANGELOG * Update integration test * Remove overlap between partitions Co-authored-by: Joel Labes <joel.labes@dbtlabs.com>
1 parent a77aebf commit 53f8352

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515

1616
## Fixes
1717
- Better handling of whitespaces in the star macro ([#651](https://github.com/dbt-labs/dbt-utils/pull/651))
18+
- Fix to correct behavior in `mutually_exclusive_ranges` test in certain situations when `zero_length_range_allowed: true` and multiple ranges in a partition have the same value for `lower_bound_column`. ([[#659](https://github.com/dbt-labs/dbt-utils/issues/659)], [#660](https://github.com/dbt-labs/dbt-utils/pull/660))
1819

1920
## Contributors:
2021
- [@christineberger](https://github.com/christineberger) (#624)
2122
- [@courentin](https://github.com/courentin) (#651)
23+
- [@sfc-gh-ancoleman](https://github.com/sfc-gh-ancoleman) (#660)
2224

2325
# dbt-utils v0.8.6
2426

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
subscription_id,valid_from,valid_to
22
3,2020-05-06,2020-05-07
3+
3,2020-05-08,2020-05-10
34
3,2020-05-08,2020-05-08
4-
3,2020-05-09,2020-05-10
5+
3,2020-05-12,2020-05-15
56
4,2020-06-06,2020-06-07
67
4,2020-06-08,2020-06-08
7-
4,2020-06-09,2020-06-10
8+
4,2020-06-09,2020-06-10

macros/generic_tests/mutually_exclusive_ranges.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ with window_functions as (
4242

4343
lead({{ lower_bound_column }}) over (
4444
{{ partition_clause }}
45-
order by {{ lower_bound_column }}
45+
order by {{ lower_bound_column }}, {{ upper_bound_column }}
4646
) as next_lower_bound,
4747

4848
row_number() over (
4949
{{ partition_clause }}
50-
order by {{ lower_bound_column }} desc
50+
order by {{ lower_bound_column }} desc, {{ upper_bound_column }} desc
5151
) = 1 as is_last_record
5252

5353
from {{ model }}

0 commit comments

Comments
 (0)