Skip to content

Commit

Permalink
Fix that stubborn bug by retracting ansi equals to plain equals excep…
Browse files Browse the repository at this point in the history
…t if flag is active
  • Loading branch information
VersusFacit committed Jan 28, 2025
1 parent 6abab94 commit 0e8df0c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
{%- endmacro %}

{% macro default__equals(expr1, expr2) -%}

{%- if adapter.behavior.enable_truthy_nulls_equals_macro.no_warn %}
case when (({{ expr1 }} = {{ expr2 }}) or ({{ expr1 }} is null and {{ expr2 }} is null))
{%- else -%}
case when ({{ expr1 }} = {{ expr2 }})
{%- endif %}
then 0
else 1
end = 0

{%- if adapter.behavior.enable_truthy_nulls_equals_macro.no_warn %}
case when (({{ expr1 }} = {{ expr2 }}) or ({{ expr1 }} is null and {{ expr2 }} is null))
then 0
else 1
end = 0
{%- else -%}
({{ expr1 }} = {{ expr2 }})
{%- endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def models(self):
return {
"incremental_merge_range.sql": merge_range_sql,
"incremental_merge_time.sql": merge_time_sql,
# TODO: restore this test after figuring out why moving to monorepo has broken this
# "incremental_merge_time_with_require_partition.sql": merge_time_with_require_partition_sql,
"incremental_merge_time_with_require_partition.sql": merge_time_with_require_partition_sql,
"incremental_overwrite_date.sql": overwrite_date_sql,
"incremental_overwrite_day.sql": overwrite_day_sql,
"incremental_overwrite_day_with_copy_partitions.sql": overwrite_day_with_copy_partitions_sql,
Expand All @@ -68,14 +67,14 @@ def seeds(self):
def test__bigquery_assert_incremental_configurations_apply_the_right_strategy(self, project):
run_dbt(["seed"])
results = run_dbt()
assert len(results) == 11
assert len(results) == 12

results = run_dbt()
assert len(results) == 11
assert len(results) == 12
incremental_strategies = [
("incremental_merge_range", "merge_expected"),
("incremental_merge_time", "merge_expected"),
# ("incremental_merge_time_with_require_partition_view", "merge_expected"),
("incremental_merge_time_with_require_partition_view", "merge_expected"),
("incremental_overwrite_time", "incremental_overwrite_time_expected"),
("incremental_overwrite_date", "incremental_overwrite_date_expected"),
("incremental_overwrite_partitions", "incremental_overwrite_date_expected"),
Expand Down
6 changes: 3 additions & 3 deletions dbt-tests-adapter/src/dbt/tests/adapter/utils/base_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
{% macro equals(expr1, expr2) -%}
{%- if adapter.behavior.enable_truthy_nulls_equals_macro.no_warn %}
case when (({{ expr1 }} = {{ expr2 }}) or ({{ expr1 }} is null and {{ expr2 }} is null))
{%- else -%}
case when ({{ expr1 }} = {{ expr2 }})
{%- endif %}
then 0
else 1
end = 0
{%- else -%}
({{ expr1 }} = {{ expr2 }})
{%- endif %}
{% endmacro %}
"""

Expand Down

0 comments on commit 0e8df0c

Please sign in to comment.