-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce operator of window function. #14213
Conversation
...he/iotdb/db/queryengine/execution/operator/source/relational/aggregation/SumAccumulator.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can WindowAggregator use statistics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two getColumnIndex
are different methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see all types of xxxOffset are int, if it's needed to use double?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider memory control of cachedBlocks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
long reserved = tsBlock.getTotalInstanceSize(); | ||
memoryReservationManager.reserveMemoryCumulatively(reserved); | ||
totalMemorySize += reserved; | ||
operatorContext.recordSpecifiedInfo(CURRENT_USED_MEMORY, Long.toString(totalMemorySize)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This PR introduces a window operator in IoTDB, which can be used as backend of window function in SQL.