-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Merge LastQueryScanNode of same device #15735
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #15735 +/- ##
============================================
+ Coverage 39.09% 39.11% +0.01%
Complexity 198 198
============================================
Files 4839 4839
Lines 314856 315188 +332
Branches 39530 39567 +37
============================================
+ Hits 123108 123300 +192
- Misses 191748 191888 +140 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| public List<TRegionReplicaSet> getDataRegionReplicaSetWithTimeFilter( | ||
| String db, TSeriesPartitionSlot tSeriesPartitionSlot, Filter timeFilter) { | ||
| Map<TTimePartitionSlot, List<TRegionReplicaSet>> regionReplicaSetMap = | ||
| dataPartitionMap | ||
| .getOrDefault(db, Collections.emptyMap()) | ||
| .getOrDefault(tSeriesPartitionSlot, Collections.emptyMap()); | ||
| if (regionReplicaSetMap.isEmpty()) { | ||
| return Collections.singletonList(NOT_ASSIGNED); | ||
| } | ||
| List<TRegionReplicaSet> replicaSets = new ArrayList<>(); | ||
| Set<TRegionReplicaSet> uniqueValues = new HashSet<>(); | ||
| for (Entry<TTimePartitionSlot, List<TRegionReplicaSet>> entry : | ||
| regionReplicaSetMap.entrySet()) { | ||
| if (!TimePartitionUtils.satisfyPartitionStartTime(timeFilter, entry.getKey().startTime)) { | ||
| continue; | ||
| } | ||
| for (TRegionReplicaSet tRegionReplicaSet : entry.getValue()) { | ||
| if (uniqueValues.add(tRegionReplicaSet)) { | ||
| replicaSets.add(tRegionReplicaSet); | ||
| } | ||
| } | ||
| } | ||
| return replicaSets; | ||
| } | ||
|
|
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.
never used
| new LastQueryOperator( | ||
| driverContext.getOperatorContexts().get(4), | ||
| ImmutableList.of(updateLastCacheOperator1, updateLastCacheOperator2), | ||
| Arrays.asList(updateLastCacheOperator1, updateLastCacheOperator2), |
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.
why we need to change it into a mutable list?
| return null; | ||
| } else if (!tsBlock.isEmpty()) { | ||
| LastQueryUtil.appendLastValue(tsBlockBuilder, tsBlock); | ||
| continue; |
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.
child.next can only be called once in parent's next call
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.
return null;
| previousTsBlockIndex = 0; | ||
| if (previousTsBlock == null) { | ||
| return true; | ||
| if (previousTsBlock == null || children.get(currentIndex).hasNextWithTimer()) { |
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.
we should only call hasNextWithTimer once
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.
just return
...core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeVisitor.java
Outdated
Show resolved
Hide resolved
.../java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/last/LastQueryNode.java
Outdated
Show resolved
Hide resolved
| // if children contains LastTransformNode, this variable is only used in distribute plan | ||
| private boolean containsLastTransformNode; | ||
|
|
||
| private Map<IMeasurementSchema, Integer> measurementSchema2IdxMap; |
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.
add some comments about this field to describe its life cycle, like when will this field be set to null
.../java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/last/LastQueryNode.java
Outdated
Show resolved
Hide resolved
.../java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/process/last/LastQueryNode.java
Outdated
Show resolved
Hide resolved
| @Override | ||
| public List<PlanNode> getChildren() { | ||
| return children; | ||
| public void serialize(DataOutputStream stream) throws IOException { | ||
| super.serialize(stream); | ||
| } | ||
|
|
||
| @Override | ||
| public void addChild(PlanNode child) { | ||
| children.add(child); | ||
| public void serialize(ByteBuffer byteBuffer) { | ||
| super.serialize(byteBuffer); | ||
| } |
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.
don't need to override it?
...in/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/source/LastQueryScanNode.java
Outdated
Show resolved
Hide resolved
…ine/plan/analyze/AnalyzeVisitor.java Co-authored-by: Jackie Tien <[email protected]>
…ine/plan/planner/plan/node/process/last/LastQueryNode.java Co-authored-by: Jackie Tien <[email protected]>
…ine/plan/planner/plan/node/process/last/LastQueryNode.java Co-authored-by: Jackie Tien <[email protected]>
…ine/plan/planner/plan/node/process/last/LastQueryNode.java Co-authored-by: Jackie Tien <[email protected]>
…ine/plan/planner/plan/node/source/LastQueryScanNode.java Co-authored-by: Jackie Tien <[email protected]>
…ine/plan/planner/plan/node/process/last/LastQueryNode.java Co-authored-by: Jackie Tien <[email protected]>
|



Description
Merge LastQueryScanNode of same device
For a scenario with 31185 non-aligned devices and 1 measurement points per device.
When the last cache is hit, the optimization effect of executing the following SQL statement is:
Before this optimization:
For a scenario with 2 * 2 * 4 non-aligned devices and 80,000 measurement points per device.
When the last cache is hit, the optimization effect of executing the following SQL statement is:
Before this optimization:


After this optimization: