vldpyatkov commented on code in PR #13359:
URL: https://github.com/apache/ignite/pull/13359#discussion_r4045933002
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/window/WindowFunctionFactory.java:
##########
@@ -237,6 +243,11 @@ else if (frameEnd != end && end >= 0) {
return acc.end();
}
+ /** {@inheritDoc} */
+ @Override public boolean isAggAccumulator() {
+ return accumulator() instanceof IterableAccumulator<?>;
Review Comment:
accumulator().accumulator()
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/BufferingWindowNode.java:
##########
@@ -94,24 +99,29 @@ else if (!inLoop)
waiting--;
- if (part == null) {
- part = partFactory.get();
- part.attachMemoryTracker(nodeMemoryTracker);
- }
- else if (prevRow != null && partCmp != null &&
partCmp.compare(prevRow, row) != 0) {
- part.evalTo(rowFactory, this::appendToOutBuf);
- part.reset();
+ if (prevRow != null && partCmp != null && partCmp.compare(prevRow,
row) != 0) {
+ part.appendPartition(inBuf, inBufTracker::reset);
+ inBuf = null;
+ inBufTracker = null;
}
- part.add(row);
+ if (inBuf == null) {
+ inBuf = new ArrayList<>(IN_BUFFER_SIZE);
+ inBufTracker =
context().createNodeMemoryTracker(DFLT_ROW_OVERHEAD);
+ }
- if (part.isStreaming())
- part.evalTo(rowFactory, this::appendToOutBuf);
+ inBuf.add(row);
+ inBufTracker.onRowAdded(row);
prevRow = row;
- if (!inLoop)
+ if (inLoop)
+ return;
+
+ if (part.ready() > 0)
flush();
+ else if (waiting == 0)
Review Comment:
We need to check `requested > 0` before requesting more rows from the source.
--
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]