[IOTDB-5765] Support ORDER BY expression#9567
Merged
JackieTien97 merged 34 commits intoapache:masterfrom Apr 27, 2023
Merged
Conversation
1. refactor planDevice 2. delete aggregationTransformExpression 3. optimize the distribution plan
Currently, transformNode is designed to used only once.
1. bug1: shuffle sink causes blocked 2. bug2: error copy of sortNode
This reverts commit c3aee91.
…Node wants" This reverts commit d13d20c.
This reverts commit a39b66d.
…nsformNode Currently, transformNode is designed to used only once." This reverts commit dc4ad22
1. add IT for transform operator 2. add IT for nulls first/last
…rByTransformError
This reverts commit 5f5a5cc.
JackieTien97
requested changes
Apr 26, 2023
| Analysis analysis, QueryStatement queryStatement, ISchemaTree schemaTree) { | ||
| if (!queryStatement.hasOrderByExpression()) return; | ||
|
|
||
| Set<Expression> orderByExpressions = new LinkedHashSet<>(); |
Contributor
There was a problem hiding this comment.
Here using Set, but in QueryStatement, you use List, what if the sql like order by s1, s1, s2?
Contributor
There was a problem hiding this comment.
add such case in your IT
| } | ||
|
|
||
| List<SortItem> sortItems = queryStatement.getSortItemList(); | ||
| queryStatement.updateSortItems(orderByExpressions); |
Contributor
There was a problem hiding this comment.
It has been updated in Analyze phase.
Comment on lines
+68
to
+77
| @Override | ||
| public Comparator<MergeSortKey> thenComparing(Comparator<? super MergeSortKey> other) { | ||
| Objects.requireNonNull(other); | ||
| return new MergeSortKeyComparator(index, nullFirst, originalComparator.thenComparing(other)); | ||
| } | ||
|
|
||
| @Override | ||
| public Comparator<MergeSortKey> reversed() { | ||
| return new MergeSortKeyComparator(index, !nullFirst, originalComparator.reversed()); | ||
| } |
Contributor
There was a problem hiding this comment.
It seems that these two methods are not used in your implementation.
Comment on lines
+49
to
+51
| return comparatorCache.computeIfAbsent( | ||
| new Pair<>(originalComparator, new Pair<>(nullFirst, index)), | ||
| comparator -> new MergeSortKeyComparator(index, nullFirst, originalComparator)); |
Contributor
There was a problem hiding this comment.
This cache doesn't take effective at all. Each time the originalComparator won't be the same.
JackieTien97
approved these changes
Apr 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
userGuide: https://apache-iotdb.feishu.cn/docx/Cqp6dhiEVoUakGx0wg1clGGlneg
design doc: https://apache-iotdb.feishu.cn/docx/T1msdaV6OoTLczxzQmQccdYunif