sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

ARRAY_AGG of STRUCT types in GROUP BY queries issue V2

Open mChlopek opened this issue 4 months ago • 2 comments

Related to closed issue : https://github.com/TobikoData/sqlmesh/issues/5262 Has this been released? I can't find these changes in the releases and still have issues using latest version

The issue appears to be that SQLMesh is incorrectly parsing `ARRAY_AGG(STRUCT(...)) Column custom_fields contains an aggregation function, which is not allowed in GROUP BY at [1:695]

The commented out line of code works fine in bq sql dbt. I had to create a new structure to make it work (but it shouldn't work that way).

SELECT task_id --, ARRAY_AGG(custom_field) AS custom_fields this line should work as do with dbt , ARRAY_AGG( STRUCT( custom_field.id, custom_field.type, custom_field.name, custom_field.required, custom_field.value, custom_field.reference ) ) AS custom_fields FROM custom_fields GROUP BY task_id Thanks in advance for help!

mChlopek avatar Sep 26 '25 11:09 mChlopek

Hey @mChlopek, apologies for missing the other comment. I'll circle back to this later, thanks for re-surfacing.

georgesittas avatar Sep 26 '25 13:09 georgesittas

Hey @mChlopek, just to confirm, is this still happening on the latest SQLMesh version? The fix should have been released already.

Thanks for checking!

VaggelisD avatar Oct 09 '25 16:10 VaggelisD