rusackas opened a new pull request, #41946: URL: https://github.com/apache/superset/pull/41946
### SUMMARY When a Trino database has `Enable row expansion in schemas` (`expand_rows`) turned on, nested `ROW` fields (e.g. `metadata.uuid`) get expanded into dotted-name dataset columns. `TrinoEngineSpec._expand_columns` already computes the correctly per-segment-quoted expression for these (`"metadata"."uuid"`) and exposes it via `query_as`, but that hint was only ever consumed by `select_star` (used by the SQL Lab "View As" preview). `SqlaTable.fetch_metadata`, which is what actually creates the `TableColumn` used by chart/filter/dashboard queries, never set an `expression` for these new columns, so SQLAlchemy fell back to quoting the whole dotted name as a single identifier (`"metadata.uuid"`), which Trino rejects with `COLUMN_NOT_FOUND`. This adds a plain `expression` field (the quoted path without the `AS` alias) to `_expand_columns`'s output, and has `fetch_metadata` set `TableColumn.expression` from it whenever it's present — both when a column is first synced and on subsequent "sync columns from source" re-fetches (the latter previously always reset `expression` back to `""`, which would have silently re-broken things after a fix). Custom SQL already worked around this because it went through `select_star`/`query_as`; this fixes the column-picker path so nested fields work in chart dimensions and dashboard filters too. ### TESTING INSTRUCTIONS - `pytest tests/unit_tests/connectors/sqla/models_test.py -k expanded_nested` - `pytest tests/unit_tests/db_engine_specs/test_trino.py` - Manually: enable `expand_rows` on a Trino dataset with a nested `ROW` column, add the expanded column as a chart dimension or dashboard filter (not Custom SQL) — the generated query should now quote each path segment separately instead of the whole dotted name. ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #27034 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
