rusackas opened a new pull request, #42255: URL: https://github.com/apache/superset/pull/42255
### SUMMARY Test-only PR — closes #28327. Issue #28327 reported that Superset generates `GROUP BY 1` (positional/ordinal) SQL for Oracle charts and filters, which fails with `ORA-00979: not a GROUP BY expression` since Oracle doesn't support positional `GROUP BY`. The clearest reproduction on the thread (from `6.0.0rc4`) was: save `SELECT 'foo' AS bar FROM dual` as a dataset, then build a bar chart with `BAR` as the dimension and `COUNT(*)` as the metric. This turned out to be the same root cause already diagnosed and fixed for #35414: `sqlglot < 27.21.0` rewrote `GROUP BY` expressions that matched aliased projections (exactly what SQLAlchemy emits for chart queries) into ordinals when generating Oracle SQL. `master` currently pins `sqlglot==30.12.0` (`requirements/base.txt`), which contains the upstream fix, and #41834 already added a regression test for the general case. This PR adds a second regression test covering the specific query shape from #28327's reproduction: a virtual-dataset subquery (`SELECT ... FROM (SELECT 'foo' AS bar FROM dual) AS virtual_table GROUP BY bar`) with a `COUNT(*)` aggregate, using the Oracle dialect. I verified it passes on current `master`: ``` tests/unit_tests/sql/parse_tests.py::test_format_oracle_group_by_keeps_explicit_expressions_subquery PASSED ``` No production code changes — the fix already landed via the sqlglot dependency bump. This just pins the specific #28327 scenario so a future sqlglot downgrade or Oracle-dialect regression doesn't silently reintroduce `ORA-00979`. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A (test-only) ### TESTING INSTRUCTIONS ```bash pytest tests/unit_tests/sql/parse_tests.py::test_format_oracle_group_by_keeps_explicit_expressions_subquery -x -q ``` ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #28327 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] 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]
