calogica / dbt-expectations

Port(ish) of Great Expectations to dbt test macros
https://calogica.github.io/dbt-expectations/
Apache License 2.0
1.04k stars 126 forks source link

Error in timestamp comparison in expect_grouped_row_values_to_have_recent_data #180

Closed clausherther closed 2 years ago

clausherther commented 2 years ago

@pan-kadams reports the following error on BigQuery when using expect_grouped_row_values_to_have_recent_data

No matching signature for operator < for argument types: TIMESTAMP, DATETIME. Supported signature: ANY < ANY at [38:9]

See: https://github.com/calogica/dbt-expectations/issues/104#issuecomment-1146246737

clausherther commented 2 years ago

This issue here is that if the column passed in is not a timestamp datatype, BigQuery won't implicitly convert this during the < comparison. So, the fix is likely to explicitly cast both sides of the evaluation to a timestamp.