dosubot[bot] commented on issue #37044: URL: https://github.com/apache/superset/issues/37044#issuecomment-3737201265
<!-- Greeting --> Hi @martuafernando! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> Oracle does not support positional references in the GROUP BY clause (like GROUP BY 1); it requires explicit column names or expressions. Superset relies on SQLGlot to generate dialect-specific SQL, and currently, there is no logic in Superset to rewrite positional GROUP BY references to column names for Oracle. This means that if SQLGlot emits GROUP BY 1 for Oracle, it will result in the ORA-00979 error you’re seeing, as Oracle expects GROUP BY "REGION" instead. Recent updates to SQLGlot in Superset (now at version 27.15.2) do not mention a fix for this issue, and there is no configuration in Superset to force column names in GROUP BY for Oracle. The transpile_to_dialect feature in Superset is primarily used for WHERE and HAVING clauses and does not address GROUP BY positional references for Oracle either. The GROUP BY clause generation is determined by SQLGlot itself, not by Superset code, so a fix would likely need to happen upstream in SQLGlot or via a custom patch to rewrite GROUP BY clauses for Oracle before execution. [Reference](https://github.com/apache/superset/blob/master/superset/sql/parse.py) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/af0ac6de-095e-4c54-9918-b912053da039?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/af0ac6de-095e-4c54-9918-b912053da039?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/af0ac6de-095e-4c54-9918-b912053da039?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/af0ac6de-095e-4c54-9918-b912053da039?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/af0ac6de-095e-4c54-9918-b912053da039?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/af0ac6de-095e-4c54-9918-b912053da039?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/af0ac6de-095e-4c54-9918-b912053da039?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=Oracle%20does%20not%20support%20positional%20references%20in%20the%20GROUP%20BY%20clause%20%28like%20GROUP%20BY%201%29%3B%20it%20requires%20explicit%20column%20names%20or%20expressions.%20Superset%20relies%20on%20SQLGlot%20to%20generate%20dialect-specific%20SQL%2C%20and%20currently%2C%20there%20is%20no%20logic%20in%20Superset%20to%20rewrite%20positional%20GROUP%20BY%20references%20to%20column%20names%20for%20Oracle.%20This%20means%20that%20if%20SQLGlot%20emits%20GROUP%20BY%201%20for%20Oracle%2C%20it%20will%20result%20in%20the%20ORA-00979%20error%20you%E2%80%99re%20seeing%2C%20as%20Oracle%20expects%20GROUP%20BY%20%22REGION%22%20instead.%0A%0ARecent%20updates%20to%20SQLGlot%20in%20Superset%20%28now%20at%20version%2027.15.2%29%20do%20not%20mention%20a %20fix%20for%20this%20issue%2C%20and%20there%20is%20no%20configuration%20in%20Superset%20to%20force%20column%20names%20in%20GROUP%20BY%20for%20Oracle.%20The%20transpile_to_dialect%20feature%20in%20Superset%20is%20primarily%20used%20for%20WHERE%20and%20HAVING%20clauses%20and%20does%20not%20address%20GROUP%20BY%20positional%20references%20for%20Oracle%20either.%20The%20GROUP%20BY%20clause%20generation%20is%20determined%20by%20SQLGlot%20itself%2C%20not%20by%20Superset%20code%2C%20so%20a%20fix%20would%20likely%20need%20to%20happen%20upstream%20in%20SQLGlot%20or%20via%20a%20custom%20patch%20to%20rewrite%20GROUP%20BY%20clauses%20for%20Oracle%20before%20execution.%20%20%0A%5BReference%5D%28https%3A//github.com/apache/superset/blob/master/superset/sql/parse.py%29) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/twee t?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37044) -- 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]
