Is this a new bug in dbt-expectations?
Current Behavior
When running expect_row_values_to_have_data_for_every_n_datepart on Trino (Starburst), the test fails with a SQL compilation error.
TrinoUserError(type=USER_ERROR, name=COLUMN_NOT_FOUND, message="line 150:9: Column 'date_day' cannot be resolved"
This happens because the macro generates a query that attempts to GROUP BY the column alias (e.g., date_day) defined in the SELECT clause. Trino/Presto engines resolve the GROUP BY clause before the SELECT projection, so the alias is not yet available at that stage.
Expected Behavior
The test should compile and run successfully on Trino/Starburst, correctly grouping the records by the calculated date intervals.
Steps To Reproduce
- Configure a dbt project with a Trino/Starburst adapter.
- Add the test to a model using a configuration similar to this:
version: 2
models:
- name: my_generic_model
data_tests:
- dbt_expectations.expect_row_values_to_have_data_for_every_n_datepart:
date_col: event_date
date_part: day
interval: 1
- Run dbt test.
Relevant log output
TrinoUserError(type=USER_ERROR, name=COLUMN_NOT_FOUND, message="line 150:9: Column 'date_day' cannot be resolved"
Environment
- OS: MacOS 15.6.1
- Python: 3.11.14
- dbt: 1.10.8
- dbt-expectations: 0.10.9
Which database adapter are you using with dbt?
Is this a new bug in dbt-expectations?
Current Behavior
When running expect_row_values_to_have_data_for_every_n_datepart on Trino (Starburst), the test fails with a SQL compilation error.
This happens because the macro generates a query that attempts to GROUP BY the column alias (e.g., date_day) defined in the SELECT clause. Trino/Presto engines resolve the GROUP BY clause before the SELECT projection, so the alias is not yet available at that stage.
Expected Behavior
The test should compile and run successfully on Trino/Starburst, correctly grouping the records by the calculated date intervals.
Steps To Reproduce
Relevant log output
TrinoUserError(type=USER_ERROR, name=COLUMN_NOT_FOUND, message="line 150:9: Column 'date_day' cannot be resolved"Environment
Which database adapter are you using with dbt?