Skip to content

[IOTDB-5765] Support ORDER BY expression#9567

Merged
JackieTien97 merged 34 commits intoapache:masterfrom
ycycse:orderByExpression
Apr 27, 2023
Merged

[IOTDB-5765] Support ORDER BY expression#9567
JackieTien97 merged 34 commits intoapache:masterfrom
ycycse:orderByExpression

Conversation

@ycycse
Copy link
Copy Markdown
Member

@ycycse ycycse commented Apr 10, 2023

ycycse and others added 30 commits April 7, 2023 13:53
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.
…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
Analysis analysis, QueryStatement queryStatement, ISchemaTree schemaTree) {
if (!queryStatement.hasOrderByExpression()) return;

Set<Expression> orderByExpressions = new LinkedHashSet<>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here using Set, but in QueryStatement, you use List, what if the sql like order by s1, s1, s2?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add such case in your IT

}

List<SortItem> sortItems = queryStatement.getSortItemList();
queryStatement.updateSortItems(orderByExpressions);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been updated in Analyze phase.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that these two methods are not used in your implementation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +49 to +51
return comparatorCache.computeIfAbsent(
new Pair<>(originalComparator, new Pair<>(nullFirst, index)),
comparator -> new MergeSortKeyComparator(index, nullFirst, originalComparator));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cache doesn't take effective at all. Each time the originalComparator won't be the same.

@JackieTien97 JackieTien97 merged commit ba4dea6 into apache:master Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants