xiedeyantu commented on code in PR #4495:
URL: https://github.com/apache/calcite/pull/4495#discussion_r2264161111
##########
core/src/main/java/org/apache/calcite/tools/RelBuilder.java:
##########
@@ -4446,8 +4531,12 @@ private class AggCallImpl implements AggCallPlus {
// return a call that is "approximately equivalent ... and is good for
// deriving field names", so dummy values are good enough.
final RelCollation collation = RelCollations.EMPTY;
- final RelDataType type =
- getTypeFactory().createSqlType(SqlTypeName.BOOLEAN);
+ final RelDataType type;
+ if (aggFunction.getKind() == SqlKind.GROUP_ID) {
+ type = getTypeFactory().createSqlType(SqlTypeName.BIGINT);
Review Comment:
The `ReturnTypes` of GROUP_ID is `ReturnTypes.BIGINT`, please see here
```
SqlGroupIdFunction() {
super("GROUP_ID", SqlKind.GROUP_ID, ReturnTypes.BIGINT, null,
OperandTypes.NILADIC, SqlFunctionCategory.SYSTEM);
}
```
Good catch! This modification is related to a test
case(`testAggregateGroupingSetsGroupId`), which uses
`builder.aggregateCall(SqlStdOperatorTable.GROUP_ID).as("g"))` to construct
GROUP_ID, but returns Boolean type by default.
--
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]