oleg-zinovev commented on code in PR #13359:
URL: https://github.com/apache/ignite/pull/13359#discussion_r4182679830
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/WindowExecutionTest.java:
##########
@@ -550,7 +572,8 @@ private void checkWindow(
}
/** */
- private WindowNode<Object[]> createWindowNode(ExecutionContext<Object[]>
ctx, Window.Group grp, Node<Object[]> input) {
+ private Node<Object[]> createWindowNode(ExecutionContext<Object[]> ctx,
Window.Group grp,
Review Comment:
fixed
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/window/WindowPartitionFactory.java:
##########
@@ -28,56 +27,55 @@
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
/** Factory to create {@link WindowPartitionBase} factory from {@link
Window.Group}. */
-public final class WindowPartitionFactory<Row> implements
Supplier<WindowPartition<Row>> {
- /** */
- private final WindowFunctionFactory<Row> funcFactory;
-
+public final class WindowPartitionFactory<Row> {
/** */
private final ExecutionContext<Row> ctx;
/** */
- private final Window.Group grp;
+ public WindowPartitionFactory(ExecutionContext<Row> ctx) {
+ this.ctx = ctx;
+ }
- /** */
- private final RelDataType inputRowType;
+ /** Creates streaming window partition for provieded group, aggragates and
input row type, */
+ public StreamingWindowPartition<Row> newStreamingPartition(Window.Group
grp, List<AggregateCall> calls,
+ RelDataType inputRowType) {
- /** */
- private final RowHandler.RowFactory<Row> rowFactory;
+ assert WindowFunctions.streamable(grp);
- /** */
- private final Comparator<Row> peerCmp;
+ return createPartition(grp, calls, inputRowType,
StreamingWindowPartition::new);
+ }
- /** */
- private final boolean streamable;
+ /** Creates buffering window partition for provieded group, aggragates and
input row type, */
+ public BufferingWindowPartition<Row> newBufferingPartition(Window.Group
grp, List<AggregateCall> calls,
+ RelDataType inputRowType) {
- /** */
- public WindowPartitionFactory(
- ExecutionContext<Row> ctx,
- Window.Group grp,
- List<AggregateCall> calls,
- RelDataType inputRowType
- ) {
- this.ctx = ctx;
- this.grp = grp;
- this.inputRowType = inputRowType;
+ return createPartition(grp, calls, inputRowType, (peerCmp,
funcFactory, rowFactory)
+ -> new BufferingWindowPartition<>(peerCmp, funcFactory,
rowFactory, ctx, grp, inputRowType));
+ }
- List<RelDataType> aggTypes = Commons.transform(calls,
AggregateCall::getType);
- rowFactory = ctx.rowHandler().factory(Commons.typeFactory(), aggTypes);
+ /** */
+ private <T extends WindowPartition<Row>> T createPartition(Window.Group
grp, List<AggregateCall> calls,
Review Comment:
fixed
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/window/WindowPartitionFactory.java:
##########
@@ -28,56 +27,55 @@
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
/** Factory to create {@link WindowPartitionBase} factory from {@link
Window.Group}. */
-public final class WindowPartitionFactory<Row> implements
Supplier<WindowPartition<Row>> {
- /** */
- private final WindowFunctionFactory<Row> funcFactory;
-
+public final class WindowPartitionFactory<Row> {
/** */
private final ExecutionContext<Row> ctx;
/** */
- private final Window.Group grp;
+ public WindowPartitionFactory(ExecutionContext<Row> ctx) {
+ this.ctx = ctx;
+ }
- /** */
- private final RelDataType inputRowType;
+ /** Creates streaming window partition for provieded group, aggragates and
input row type, */
+ public StreamingWindowPartition<Row> newStreamingPartition(Window.Group
grp, List<AggregateCall> calls,
+ RelDataType inputRowType) {
- /** */
- private final RowHandler.RowFactory<Row> rowFactory;
+ assert WindowFunctions.streamable(grp);
- /** */
- private final Comparator<Row> peerCmp;
+ return createPartition(grp, calls, inputRowType,
StreamingWindowPartition::new);
+ }
- /** */
- private final boolean streamable;
+ /** Creates buffering window partition for provieded group, aggragates and
input row type, */
+ public BufferingWindowPartition<Row> newBufferingPartition(Window.Group
grp, List<AggregateCall> calls,
Review Comment:
fixed
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/window/WindowPartitionFactory.java:
##########
@@ -28,56 +27,55 @@
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
/** Factory to create {@link WindowPartitionBase} factory from {@link
Window.Group}. */
-public final class WindowPartitionFactory<Row> implements
Supplier<WindowPartition<Row>> {
- /** */
- private final WindowFunctionFactory<Row> funcFactory;
-
+public final class WindowPartitionFactory<Row> {
/** */
private final ExecutionContext<Row> ctx;
/** */
- private final Window.Group grp;
+ public WindowPartitionFactory(ExecutionContext<Row> ctx) {
+ this.ctx = ctx;
+ }
- /** */
- private final RelDataType inputRowType;
+ /** Creates streaming window partition for provieded group, aggragates and
input row type, */
+ public StreamingWindowPartition<Row> newStreamingPartition(Window.Group
grp, List<AggregateCall> calls,
Review Comment:
fixed
--
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]