9
9
1 as day_of_week,
10
10
7 as iso_day_of_week,
11
11
334 as day_of_year,
12
- cast(' 2020-11-29 ' as date ) as week_start_date,
13
- cast(' 2020-12-05 ' as date ) as week_end_date,
12
+ cast(' {{ get_test_week_start_date()[0] }} ' as date ) as week_start_date,
13
+ cast(' {{ get_test_week_end_date()[0] }} ' as date ) as week_end_date,
14
14
{{ get_test_week_of_year()[0 ] }} as week_of_year,
15
15
-- in ISO terms, this is the end of the prior week
16
16
cast(' 2020-11-23' as date ) as iso_week_start_date,
44
44
3 as day_of_week,
45
45
2 as iso_day_of_week,
46
46
336 as day_of_year,
47
- cast(' 2020-11-29 ' as date ) as week_start_date,
48
- cast(' 2020-12-05 ' as date ) as week_end_date,
47
+ cast(' {{ get_test_week_start_date()[1] }} ' as date ) as week_start_date,
48
+ cast(' {{ get_test_week_end_date()[1] }} ' as date ) as week_end_date,
49
49
{{ get_test_week_of_year()[1 ] }} as week_of_year,
50
50
cast(' 2020-11-30' as date ) as iso_week_start_date,
51
51
cast(' 2020-12-06' as date ) as iso_week_end_date,
@@ -83,6 +83,39 @@ select
83
83
{{ return([48 ,49 ]) }}
84
84
{%- endmacro %}
85
85
86
+ {% macro spark__get_test_week_of_year() - %}
87
+ {# weeks_of_year for '2020-11-29' and '2020-12-01', respectively #}
88
+ {# spark uses ISO year #}
89
+ {{ return([48 ,49 ]) }}
90
+ {%- endmacro %}
91
+
92
+
93
+ {% macro get_test_week_start_date() - %}
94
+ {{ return(adapter .dispatch (' get_test_week_start_date' , ' dbt_date_integration_tests' ) ()) }}
95
+ {%- endmacro %}
96
+
97
+ {% macro default__get_test_week_start_date() - %}
98
+ {{ return([' 2020-11-29' , ' 2020-11-29' ]) }}
99
+ {%- endmacro %}
100
+
101
+ {% macro spark__get_test_week_start_date() - %}
102
+ {# spark does not support non-iso weeks #}
103
+ {{ return([' 2020-11-23' , ' 2020-11-30' ]) }}
104
+ {%- endmacro %}
105
+
106
+
107
+ {% macro get_test_week_end_date() - %}
108
+ {{ return(adapter .dispatch (' get_test_week_end_date' , ' dbt_date_integration_tests' ) ()) }}
109
+ {%- endmacro %}
110
+
111
+ {% macro default__get_test_week_end_date() - %}
112
+ {{ return([' 2020-12-05' , ' 2020-12-05' ]) }}
113
+ {%- endmacro %}
114
+
115
+ {% macro spark__get_test_week_end_date() - %}
116
+ {# spark does not support non-iso weeks #}
117
+ {{ return([' 2020-11-29' , ' 2020-12-06' ]) }}
118
+ {%- endmacro %}
86
119
87
120
88
121
{% macro get_test_timestamps() - %}
@@ -108,3 +141,8 @@ select
108
141
{{ return([' 2021-06-07 07:35:20.000000' ,
109
142
' 2021-06-07 14:35:20.000000' ]) }}
110
143
{%- endmacro %}
144
+
145
+ {% macro spark__get_test_timestamps() - %}
146
+ {{ return([' 2021-06-07 07:35:20.000000' ,
147
+ ' 2021-06-07 14:35:20.000000' ]) }}
148
+ {%- endmacro %}
0 commit comments