Vladsz83 commented on code in PR #11478: URL: https://github.com/apache/ignite/pull/11478#discussion_r1763133571
########## modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulators.java: ########## @@ -312,10 +316,52 @@ private static class SingleVal<Row> extends AnyVal<Row> { } } + /** + * LITERAL_AGG accumulator, returns predefined literal value. + * Calcite`s implementation RexImpTable#LiteralAggImplementor. + */ + private static class LiteralVal<Row> extends AbstractAccumulator<Row> { + /** */ + public LiteralVal(AggregateCall aggCall, RowHandler<Row> hnd) { + super(aggCall, hnd); + } + + /** {@inheritDoc} */ + @Override public void add(Row row) { + // No-op. + } + + /** {@inheritDoc} */ + @Override public void apply(Accumulator<Row> other) { + // No-op. + } + + /** {@inheritDoc} */ + @Override public Object end() { + assert !F.isEmpty(aggregateCall().rexList) : "aggregateCall().rexList is empty for LITERAL_AGG"; + + RexNode rexNode = aggregateCall().rexList.get(0); + + assert rexNode instanceof RexLiteral; + + return ((RexLiteral)rexNode).getValue(); + } + + /** {@inheritDoc} */ + @Override public List<RelDataType> argumentTypes(IgniteTypeFactory typeFactory) { + return F.asList(typeFactory.createTypeWithNullability(typeFactory.createSqlType(ANY), true)); + } + + /** {@inheritDoc} */ + @Override public RelDataType returnType(IgniteTypeFactory typeFactory) { + return aggregateCall().getType(); + } + } + /** */ private static class AnyVal<Row> extends AbstractAccumulator<Row> { /** */ - private Object holder; + protected Object holder; Review Comment: private? -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org