Skip to content

Commit 33d17f7

Browse files
haritamarclaude
andcommitted
Fix ClickHouse and DuckDB CI failures
ClickHouse: reorder columns in freshness SLA final_result CTE so is_failure is computed before sla_deadline_utc is cast to string (ClickHouse resolves column refs to already-aliased columns in the same SELECT, causing DateTime vs String type mismatch). DuckDB: add explicit casts to LAG window function results in volume_threshold to work around DuckDB internal binder bug that confuses TIMESTAMP and FLOAT types across multiple LAG calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a2f6944 commit 33d17f7

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

macros/edr/tests/test_data_freshness_sla.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,20 +277,22 @@
277277
target_date,
278278
'{{ formatted_sla_time }}' as sla_time,
279279
'{{ timezone }}' as timezone,
280-
cast(
281-
sla_deadline_utc as {{ elementary.edr_type_string() }}
282-
) as sla_deadline_utc,
283280
freshness_status,
284281
cast(
285282
max_timestamp as {{ elementary.edr_type_string() }}
286283
) as max_timestamp,
284+
{# Compute is_failure before casting sla_deadline_utc to string,
285+
so the comparison uses the original timestamp type. #}
287286
{{
288287
elementary.edr_condition_as_boolean(
289288
"freshness_status != 'DATA_FRESH' and "
290289
~ elementary.edr_current_timestamp_in_utc()
291290
~ " > sla_deadline_utc"
292291
)
293292
}} as is_failure,
293+
cast(
294+
sla_deadline_utc as {{ elementary.edr_type_string() }}
295+
) as sla_deadline_utc,
294296
{# BigQuery does not support '' to escape single quotes inside string literals.
295297
Use \' for BigQuery and '' for all other adapters. #}
296298
{%- if target.type == "bigquery" -%}

macros/edr/tests/test_volume_threshold.sql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,16 @@
195195
bucket_start,
196196
bucket_end,
197197
row_count,
198-
lag(row_count) over (order by bucket_end) as prev_row_count,
199-
lag(bucket_end) over (order by bucket_end) as prev_bucket_end,
198+
cast(
199+
lag(row_count) over (
200+
order by bucket_end
201+
) as {{ elementary.edr_type_numeric() }}
202+
) as prev_row_count,
203+
cast(
204+
lag(bucket_end) over (
205+
order by bucket_end
206+
) as {{ elementary.edr_type_timestamp() }}
207+
) as prev_bucket_end,
200208
row_number() over (order by bucket_end desc) as rn
201209
from metrics
202210
),

0 commit comments

Comments
 (0)