Introduce operator of window function.#14213
Conversation
...he/iotdb/db/queryengine/execution/operator/source/relational/aggregation/SumAccumulator.java
Show resolved
Hide resolved
...che/iotdb/db/queryengine/execution/operator/process/window/exception/FrameTypeException.java
Outdated
Show resolved
Hide resolved
.../iotdb/db/queryengine/execution/operator/process/window/function/value/LeadFunctionTest.java
Outdated
Show resolved
Hide resolved
.../iotdb/db/queryengine/execution/operator/process/window/function/value/LeadFunctionTest.java
Outdated
Show resolved
Hide resolved
.../iotdb/db/queryengine/execution/operator/process/window/function/value/LeadFunctionTest.java
Outdated
Show resolved
Hide resolved
| accumulator.evaluateFinal(columnBuilder); | ||
| } | ||
|
|
||
| public void processStatistics(Statistics[] statistics) { |
There was a problem hiding this comment.
Can WindowAggregator use statistics?
There was a problem hiding this comment.
Theoretically yes, but it's really rare. A frame must not be smaller than a chunk/page/tsfile so that it can use its statistics.
So I choose to remain this method.
...a/org/apache/iotdb/db/queryengine/execution/operator/process/window/utils/RowComparator.java
Show resolved
Hide resolved
| } | ||
|
|
||
| public boolean getBoolean(int position) { | ||
| ColumnListIndex columnListIndex = getColumnIndex(position); |
There was a problem hiding this comment.
| ColumnListIndex columnListIndex = getColumnIndex(position); | |
| ColumnListIndex columnListIndex = getColumnIndex(position); | |
| int columnIndex = columnListIndex.getColumnIndex(); |
These two lines are duplicated in getXXX method
There was a problem hiding this comment.
These two getColumnIndex are different methods.
There was a problem hiding this comment.
Maybe getColumnListIndex is more intuitive.
...java/org/apache/iotdb/db/queryengine/execution/operator/process/window/utils/ColumnList.java
Outdated
Show resolved
Hide resolved
...apache/iotdb/db/queryengine/execution/operator/process/window/partition/frame/RowsFrame.java
Outdated
Show resolved
Hide resolved
...a/org/apache/iotdb/db/queryengine/execution/operator/process/window/TableWindowOperator.java
Outdated
Show resolved
Hide resolved
...pache/iotdb/db/queryengine/execution/operator/process/window/partition/frame/RangeFrame.java
Outdated
Show resolved
Hide resolved
| // Then it is stored in double | ||
| private final double startOffset; // For PRECEDING and FOLLOWING use | ||
| private final FrameBoundType endType; | ||
| private final double endOffset; // Same as startOffset |
There was a problem hiding this comment.
I see all types of xxxOffset are int, if it's needed to use double?
There was a problem hiding this comment.
RangeFrame may have offset with decimal, it cannot be stored by int type.
And the FrameInfo instances count is equal to the number of frame clause in user's SQL, so it wont cause too much extra memory footprint.
...a/org/apache/iotdb/db/queryengine/execution/operator/process/window/partition/Partition.java
Show resolved
Hide resolved
iotdb-core/confignode/src/test/resources/confignode1conf/iotdb-system.properties
Outdated
Show resolved
Hide resolved
...a/org/apache/iotdb/db/queryengine/execution/operator/process/window/TableWindowOperator.java
Show resolved
Hide resolved
|
|
||
| // May return null if builder is not full | ||
| return transform(); | ||
| } else if (!cachedTsBlocks.isEmpty()) { |
There was a problem hiding this comment.
consider memory control of cachedBlocks
There was a problem hiding this comment.
Done. Support for explain analysis is added as well.
...db/db/queryengine/execution/operator/process/window/function/aggregate/WindowAggregator.java
Outdated
Show resolved
Hide resolved
...a/org/apache/iotdb/db/queryengine/execution/operator/process/window/TableWindowOperator.java
Outdated
Show resolved
Hide resolved
| // PartitionExecutor only hold reference to TsBlock | ||
| // So only cached TsBlocks are considered | ||
| long maxPeekMemoryFromCurrent = | ||
| (long) cachedTsBlocks.size() |
There was a problem hiding this comment.
Method calculateMaxPeekMemory is used before the execution of operator, so cachedTsBlocks.size() will always equals to 0.
And the memory of cachedTsBlocks haven been managed by memoryReservationManager.
| long reserved = tsBlock.getTotalInstanceSize(); | ||
| memoryReservationManager.reserveMemoryCumulatively(reserved); | ||
| totalMemorySize += reserved; | ||
| operatorContext.recordSpecifiedInfo(CURRENT_USED_MEMORY, Long.toString(totalMemorySize)); |

This PR introduces a window operator in IoTDB, which can be used as backend of window function in SQL.