Skip to content

Commit d3d3be1

Browse files
committed
Merge branch 'feat/TG-1005-daily-record-ct-date-truncation' into 'enterprise'
fix(TG-1005): Daily_Record_Ct date truncation + CI fix + timestamp test coverage See merge request dkinternal/testgen/dataops-testgen!443
2 parents 3c496c6 + 25636ca commit d3d3be1

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

testgen/template/dbsetup_test_types/test_types_Daily_Record_Ct.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,55 +52,55 @@ test_types:
5252
test_type: Daily_Record_Ct
5353
sql_flavor: databricks
5454
measure: |-
55-
<%DATEDIFF_DAY;MIN({COLUMN_NAME});MAX({COLUMN_NAME})%>+1-COUNT(DISTINCT {COLUMN_NAME})
55+
<%DATEDIFF_DAY;MIN({COLUMN_NAME});MAX({COLUMN_NAME})%>+1-COUNT(DISTINCT CAST({COLUMN_NAME} AS DATE))
5656
test_operator: '>'
5757
test_condition: |-
5858
{THRESHOLD_VALUE}
5959
- id: '3005'
6060
test_type: Daily_Record_Ct
6161
sql_flavor: mssql
6262
measure: |-
63-
DATEDIFF(day, MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT {COLUMN_NAME})
63+
DATEDIFF(day, MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT CAST({COLUMN_NAME} AS DATE))
6464
test_operator: '>'
6565
test_condition: |-
6666
{THRESHOLD_VALUE}
6767
- id: '4005'
6868
test_type: Daily_Record_Ct
6969
sql_flavor: postgresql
7070
measure: |-
71-
<%DATEDIFF_DAY;MIN({COLUMN_NAME});MAX({COLUMN_NAME})%>+1-COUNT(DISTINCT {COLUMN_NAME})
71+
<%DATEDIFF_DAY;MIN({COLUMN_NAME});MAX({COLUMN_NAME})%>+1-COUNT(DISTINCT CAST({COLUMN_NAME} AS DATE))
7272
test_operator: '>'
7373
test_condition: |-
7474
{THRESHOLD_VALUE}
7575
- id: '1005'
7676
test_type: Daily_Record_Ct
7777
sql_flavor: redshift
7878
measure: |-
79-
DATEDIFF('DAY', MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT {COLUMN_NAME})
79+
DATEDIFF('DAY', MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT CAST({COLUMN_NAME} AS DATE))
8080
test_operator: '>'
8181
test_condition: |-
8282
{THRESHOLD_VALUE}
8383
- id: '7005'
8484
test_type: Daily_Record_Ct
8585
sql_flavor: redshift_spectrum
8686
measure: |-
87-
DATEDIFF('DAY', MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT {COLUMN_NAME})
87+
DATEDIFF('DAY', MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT CAST({COLUMN_NAME} AS DATE))
8888
test_operator: '>'
8989
test_condition: |-
9090
{THRESHOLD_VALUE}
9191
- id: '2005'
9292
test_type: Daily_Record_Ct
9393
sql_flavor: snowflake
9494
measure: |-
95-
DATEDIFF(day, MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT {COLUMN_NAME})
95+
DATEDIFF(day, MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT CAST({COLUMN_NAME} AS DATE))
9696
test_operator: '>'
9797
test_condition: |-
9898
{THRESHOLD_VALUE}
9999
- id: '5005'
100100
test_type: Daily_Record_Ct
101101
sql_flavor: trino
102102
measure: |-
103-
DATE_DIFF('DAY', MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT {COLUMN_NAME})
103+
DATE_DIFF('DAY', MIN({COLUMN_NAME}), MAX({COLUMN_NAME}))+1-COUNT(DISTINCT CAST({COLUMN_NAME} AS DATE))
104104
test_operator: '>'
105105
test_condition: |-
106106
{THRESHOLD_VALUE}
@@ -166,7 +166,7 @@ test_types:
166166
sql_flavor: databricks
167167
lookup_type: null
168168
lookup_query: |-
169-
WITH date_bounds AS( SELECT MIN(`{COLUMN_NAME}`) AS min_date, MAX(`{COLUMN_NAME}`) AS max_date FROM `{TARGET_SCHEMA}`.`{TABLE_NAME}`), all_dates AS ( SELECT EXPLODE(SEQUENCE(min_date, max_date, INTERVAL 1 DAY)) AS all_dates FROM date_bounds ), existing_periods AS ( SELECT DISTINCT CAST(`{COLUMN_NAME}` AS DATE) AS period, COUNT(1) AS period_count FROM `{TARGET_SCHEMA}`.`{TABLE_NAME}` GROUP BY CAST(`{COLUMN_NAME}` AS DATE) ), missing_dates AS ( SELECT d.all_dates AS missing_period FROM all_dates d LEFT JOIN existing_periods e ON d.all_dates = e.period WHERE e.period IS NULL ) SELECT m.missing_period, MAX(e1.period) AS prior_available_date, MAX(e1.period_count) AS prior_available_date_count, MIN(e2.period) AS next_available_date, MAX(e2.period_count) AS next_available_date_count FROM missing_dates m LEFT JOIN existing_periods e1 ON e1.period < m.missing_period LEFT JOIN existing_periods e2 ON e2.period > m.missing_period GROUP BY m.missing_period ORDER BY m.missing_period LIMIT {LIMIT};
169+
WITH date_bounds AS( SELECT CAST(MIN(`{COLUMN_NAME}`) AS DATE) AS min_date, CAST(MAX(`{COLUMN_NAME}`) AS DATE) AS max_date FROM `{TARGET_SCHEMA}`.`{TABLE_NAME}`), all_dates AS ( SELECT EXPLODE(SEQUENCE(min_date, max_date, INTERVAL 1 DAY)) AS all_dates FROM date_bounds ), existing_periods AS ( SELECT DISTINCT CAST(`{COLUMN_NAME}` AS DATE) AS period, COUNT(1) AS period_count FROM `{TARGET_SCHEMA}`.`{TABLE_NAME}` GROUP BY CAST(`{COLUMN_NAME}` AS DATE) ), missing_dates AS ( SELECT d.all_dates AS missing_period FROM all_dates d LEFT JOIN existing_periods e ON d.all_dates = e.period WHERE e.period IS NULL ) SELECT m.missing_period, MAX(e1.period) AS prior_available_date, MAX(e1.period_count) AS prior_available_date_count, MIN(e2.period) AS next_available_date, MAX(e2.period_count) AS next_available_date_count FROM missing_dates m LEFT JOIN existing_periods e1 ON e1.period < m.missing_period LEFT JOIN existing_periods e2 ON e2.period > m.missing_period GROUP BY m.missing_period ORDER BY m.missing_period LIMIT {LIMIT};
170170
error_type: Test Results
171171
- id: '1144'
172172
test_id: '1009'

0 commit comments

Comments
 (0)