julianhyde commented on code in PR #3209:
URL: https://github.com/apache/calcite/pull/3209#discussion_r1205725017
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java:
##########
@@ -1688,6 +1692,27 @@ static class GroupingImplementor implements
AggImplementor {
}
}
+ /** Implementor for the {@code LITERAL_AGG} aggregate function. */
+ static class LiteralAggImplementor implements AggImplementor {
+ @Override public List<Type> getStateType(AggContext info) {
+ return ImmutableList.of();
+ }
+
+ @Override public void implementReset(AggContext info, AggResetContext
reset) {
+ }
+
+ @Override public void implementAdd(AggContext info, AggAddContext add) {
+ }
+
+ @Override public Expression implementResult(AggContext info,
+ AggResultContext result) {
+ checkArgument(info.aggregation().kind == SqlKind.LITERAL_AGG);
+ checkArgument(result.call().rexList.size() == 1);
+ final RexNode rexNode = result.call().rexList.get(0);
Review Comment:
I don't feel strongly about it. There's some benefit to retaining
flexibility.
For example, in `Sort` we didn't validate that `limit` and `offset` were
literals and it turned out to be useful - because people wanted to use
parameters.
Clearly the expression should not contain `RexInputRef`. But calls to
parameter-less functions such as `CURRENT_DATE` seem like reasonable use cases.
--
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]