Skip to content

Commit 9a497ef

Browse files
authored
fix/redshift: replace dateadd() with inverval arithmetics
1 parent 57edccf commit 9a497ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)