darpan-e6 commented on code in PR #5074:
URL: https://github.com/apache/calcite/pull/5074#discussion_r3541429059
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/AggImpState.java:
##########
@@ -35,10 +35,22 @@ public class AggImpState {
public @MonotonicNonNull List<Expression> state;
public @MonotonicNonNull Expression accumulatorAdder;
+ /**
+ * Creates an AggImpState, resolving the implementor from the built-in table.
+ *
+ * @deprecated Use {@link #AggImpState(int, AggregateCall, boolean,
RexImplementorTable)}.
+ */
+ @Deprecated // to be removed before 2.0
public AggImpState(int aggIdx, AggregateCall call, boolean windowContext) {
+ this(aggIdx, call, windowContext, RexImpTable.INSTANCE);
+ }
+
+ public AggImpState(int aggIdx, AggregateCall call, boolean windowContext,
+ RexImplementorTable implementorTable) {
Review Comment:
`implementorTable` is only needed while constructing `AggImpState`, to
resolve the `AggImplementor`; after that the state keeps the resolved
implementor, so I did not store the table as a field.
My reason for passing it in was to avoid making `AggImpState` itself depend
on planner context. The callers already have the relevant cluster/context, so
they resolve the active table with `RexImplementorTables.of(cluster)` and pass
it here. If `AggImpState` retrieved the table internally through a static
helper, the constructor would need either the planner/cluster or would have to
fall back to the singleton, which is the path this change is trying to avoid.
That said, if you prefer resolving the table inside the constructor by
passing the cluster instead, I can change it that way.
--
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]