From c9c95fc8333bb26ff2df64e49f7283678d305901 Mon Sep 17 00:00:00 2001 From: Noopur Sharma Date: Wed, 10 Apr 2024 17:29:08 +0530 Subject: [PATCH 1/3] Changes in TestConcat and TestHash to make it consistent with changes in dbt-core --- tests/functional/adapter/test_utils.py | 52 +------------------------- 1 file changed, 2 insertions(+), 50 deletions(-) diff --git a/tests/functional/adapter/test_utils.py b/tests/functional/adapter/test_utils.py index 429103c..c396cdd 100644 --- a/tests/functional/adapter/test_utils.py +++ b/tests/functional/adapter/test_utils.py @@ -237,32 +237,8 @@ def models(self): } -models__test_concat_sql = """ -with util_data as ( - - select * from {{ ref('data_concat') }} - -) - -select - {{ concat(['input_1', 'input_2']) }} as actual, - output as expected - -from util_data -""" - - class TestConcat(BaseConcat): - @pytest.fixture(scope="class") - def seeds(self): - return {"data_concat.csv": seeds__data_concat_csv} - - @pytest.fixture(scope="class") - def models(self): - return { - "test_concat.yml": models__test_concat_yml, - "test_concat.sql": self.interpolate_macro_namespace(models__test_concat_sql, "concat"), - } + pass models__test_dateadd_sql = """ @@ -389,32 +365,8 @@ class TestExcept(BaseExcept): pass -models__test_hash_sql = """ -with util_data as ( - - select * from {{ ref('data_hash') }} - -) - -select - {{ hash('input_1') }} as actual, - output as expected - -from util_data -""" - - class TestHash(BaseHash): - @pytest.fixture(scope="class") - def seeds(self): - return {"data_hash.csv": seeds__data_hash_csv} - - @pytest.fixture(scope="class") - def models(self): - return { - "test_hash.yml": models__test_hash_yml, - "test_hash.sql": self.interpolate_macro_namespace(models__test_hash_sql, "hash"), - } + pass class TestIntersect(BaseIntersect): From 445a7d05fd0de14fecc820854cb9767f477154a3 Mon Sep 17 00:00:00 2001 From: Noopur Sharma Date: Wed, 10 Apr 2024 17:58:00 +0530 Subject: [PATCH 2/3] Changes in TestRight --- tests/functional/adapter/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/adapter/test_utils.py b/tests/functional/adapter/test_utils.py index c396cdd..392032a 100644 --- a/tests/functional/adapter/test_utils.py +++ b/tests/functional/adapter/test_utils.py @@ -600,7 +600,7 @@ def models(self): ) select {{ right('string_text', 'length_expression') }} as actual, - coalesce(output, '') as expected + nullif(output, '') as expected from util_data """ From b2e89f909e1ce1ced3364f97396e37beca92ae1c Mon Sep 17 00:00:00 2001 From: Noopur Sharma Date: Thu, 11 Apr 2024 02:46:24 +0530 Subject: [PATCH 3/3] Making the suggested changes --- dbt/include/hive/macros/utils/right.sql | 2 +- tests/functional/adapter/test_utils.py | 22 +--------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/dbt/include/hive/macros/utils/right.sql b/dbt/include/hive/macros/utils/right.sql index 10b0006..e5f00c4 100644 --- a/dbt/include/hive/macros/utils/right.sql +++ b/dbt/include/hive/macros/utils/right.sql @@ -16,7 +16,7 @@ {% macro hive__right(string_text, length_expression) %} case when {{ length_expression }} = 0 - then NULL + then '' else substr( {{ string_text }}, diff --git a/tests/functional/adapter/test_utils.py b/tests/functional/adapter/test_utils.py index 392032a..38932c3 100644 --- a/tests/functional/adapter/test_utils.py +++ b/tests/functional/adapter/test_utils.py @@ -594,28 +594,8 @@ def models(self): } -models__test_right_sql = """ -with util_data as ( - select * from {{ ref('data_right') }} -) -select - {{ right('string_text', 'length_expression') }} as actual, - nullif(output, '') as expected -from util_data -""" - - class TestRight(BaseRight): - @pytest.fixture(scope="class") - def seeds(self): - return {"data_right.csv": seeds__data_right_csv} - - @pytest.fixture(scope="class") - def models(self): - return { - "test_right.yml": models__test_right_yml, - "test_right.sql": self.interpolate_macro_namespace(models__test_right_sql, "right"), - } + pass models__test_safe_cast_sql = """