lanky228 opened a new pull request, #5064:
URL: https://github.com/apache/calcite/pull/5064
## Summary
PostgreSQL and Presto do not support `GROUPING_ID()` (a non-standard
synonym). This PR rewrites `GROUPING_ID(...)` to `GROUPING(...)` during
RelToSql conversion for those dialects.
## Changes
- **SqlDialect**: Added `rewriteGroupingIdExpr()` method (default: no-op)
- **PostgresqlSqlDialect**: Override to rewrite `GROUPING_ID` → `GROUPING`
- **PrestoSqlDialect**: Override to rewrite `GROUPING_ID` → `GROUPING`
- **SqlImplementor**: Call `dialect.rewriteGroupingIdExpr()` in
`Context.toSql(AggregateCall)`
- **RelToSqlConverterTest**: 3 tests covering PostgreSQL, Presto, and
default (no rewrite)
## Example
Before (PostgreSQL dialect):
```sql
SELECT "DEPTNO", GROUPING_ID("DEPTNO") FROM emp GROUP BY "DEPTNO"
```
After:
```sql
SELECT "DEPTNO", GROUPING("DEPTNO") FROM emp GROUP BY "DEPTNO"
```
## Testing
All 3 new tests pass. Existing GROUPING tests unchanged.
--
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]