Skip to content

Commit 685cdb4

Browse files
authored
Merge pull request #280 from ScalefreeCOM/fix/databricks-replace-unsupported-timestamp_sub-function
FIX:databricks/postgres/redshift: replace unsupported timestamp_sub- and dateadd-functions in pit macros
2 parents 9ecd6d0 + 9a497ef commit 685cdb4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

macros/tables/databricks/pit.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pit_records AS (
8080
SELECT
8181
{{ hashkey }},
8282
{{ ldts }},
83-
COALESCE(LEAD(TIMESTAMP_SUB({{ ldts }}, INTERVAL 1 MICROSECOND)) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
83+
COALESCE(LEAD(({{ldts}} - INTERVAL 1 MICROSECOND)) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
8484
FROM {{ ref(satellite) }}
8585
) {{ satellite }}
8686
{% endif %}

macros/tables/postgres/pit.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pit_records AS (
8080
SELECT
8181
{{ hashkey }},
8282
{{ ldts }},
83-
COALESCE(LEAD(TIMESTAMP_SUB({{ ldts }}, INTERVAL 1 MICROSECOND)) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
83+
COALESCE(LEAD({{ ldts }} - INTERVAL '1 MICROSECOND') OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
8484
FROM {{ ref(satellite) }}
8585
) {{ satellite }}
8686
{% endif %}

macros/tables/redshift/pit.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pit_records AS (
8282
SELECT
8383
{{ hashkey }},
8484
{{ ldts }},
85-
COALESCE(LEAD(DATEADD(microsecond,-1, {{ ldts }})) OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
85+
COALESCE(LEAD({{ ldts }} - interval '00:00:00.000001') OVER (PARTITION BY {{ hashkey }} ORDER BY {{ ldts }}),{{ datavault4dbt.string_to_timestamp(timestamp_format, end_of_all_times) }}) AS {{ ledts }}
8686
FROM {{ ref(satellite) }}
8787
) {{ satellite }}
8888
{% endif %}

0 commit comments

Comments
 (0)