Skip to content

Exasol dialect: Custom Transformation of GROUP BY ALL #5

@nnamdi16

Description

@nnamdi16

Description

SQLGlot currently transpiles GROUP BY ALL from Databricks to Exasol without rewriting it, even though Exasol does not support GROUP BY ALL. Databricks supports GROUP BY ALL as shorthand to group by all non-aggregate select expressions, but Exasol requires explicit grouping expressions.

As a result, the generated Exasol SQL is invalid.


Example

SELECT car_model, COUNT(*) FROM dealer GROUP BY ALL;

Current Behaviour

SQLGlot transpiles to Exasol as:

SELECT
  car_model,
  COUNT(*)
FROM dealer
GROUP BY ALL

This is invalid because Exasol does not support GROUP BY ALL.


Expected Behaviour

SQLGlot should transpile to valid Exasol SQL:

SELECT
  car_model,
  COUNT(*)
FROM dealer
GROUP BY car_model

Proposed solution

Add generator support in the Exasol dialect to:

• Detect GROUP BY ALL
• Expand it to explicit grouping expressions based on non-aggregate select columns
• Generate valid Exasol SQL

without modifying the original AST, ensuring correct dialect transpilation.

Metadata

Metadata

Assignees

Labels

featureProduct feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions