From af20b899fbf075cabeb41f7ea6715cdc3d429be2 Mon Sep 17 00:00:00 2001 From: Daniel Pollak Date: Tue, 26 Sep 2023 11:05:37 +0300 Subject: [PATCH 1/2] Switch ceil to floor --- dbt/include/spark/macros/utils/datediff.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbt/include/spark/macros/utils/datediff.sql b/dbt/include/spark/macros/utils/datediff.sql index d0e684c47..1d1520553 100644 --- a/dbt/include/spark/macros/utils/datediff.sql +++ b/dbt/include/spark/macros/utils/datediff.sql @@ -73,12 +73,12 @@ {%- endset -%} case when {{first_date}} < {{second_date}} - then ceil(( + then floor(( {# make sure the timestamps are real, otherwise raise an error asap #} {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', second_date)) }} - {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', first_date)) }} ) / {{divisor}}) - else floor(( + else ceil(( {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', second_date)) }} - {{ assert_not_null('to_unix_timestamp', assert_not_null('to_timestamp', first_date)) }} ) / {{divisor}}) From ac674e97cd7f468cf300a1adefc7b152b2376dba Mon Sep 17 00:00:00 2001 From: Daniel Pollak Date: Tue, 26 Sep 2023 12:49:29 +0300 Subject: [PATCH 2/2] . --- dbt/include/spark/macros/utils/datediff.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/dbt/include/spark/macros/utils/datediff.sql b/dbt/include/spark/macros/utils/datediff.sql index 1d1520553..5eeb0281a 100644 --- a/dbt/include/spark/macros/utils/datediff.sql +++ b/dbt/include/spark/macros/utils/datediff.sql @@ -105,3 +105,4 @@ {%- endif -%} {% endmacro %} +