Jackie-Jiang commented on code in PR #9078:
URL: https://github.com/apache/pinot/pull/9078#discussion_r956508569
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java:
##########
@@ -127,14 +125,22 @@ private Comparator<Object[]> getComparator() {
// Compare all single-value columns
int numOrderByExpressions = _orderByExpressions.size();
List<Integer> valueIndexList = new ArrayList<>(numOrderByExpressions);
+ List<OrderByExpressionContext> mvOrderByExpressions = new ArrayList<>();
for (int i = 0; i < numOrderByExpressions; i++) {
if (_orderByExpressionMetadata[i].isSingleValue()) {
valueIndexList.add(i);
} else {
- _queryHasMVSelectionOrderBy = true;
+ mvOrderByExpressions.add(_orderByExpressions.get(i));
}
}
+ if (mvOrderByExpressions.size() > 0) {
+ // MV columns should not be part of the selection order by only list
+ throw new UnsupportedOperationException(
+ String.format("MV columns %s should not be included in selection
order-by only queries",
Review Comment:
```suggestion
String.format("MV expression: %s should not be included in the
ORDER-BY clause",
```
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java:
##########
@@ -127,14 +125,22 @@ private Comparator<Object[]> getComparator() {
// Compare all single-value columns
int numOrderByExpressions = _orderByExpressions.size();
List<Integer> valueIndexList = new ArrayList<>(numOrderByExpressions);
+ List<OrderByExpressionContext> mvOrderByExpressions = new ArrayList<>();
for (int i = 0; i < numOrderByExpressions; i++) {
if (_orderByExpressionMetadata[i].isSingleValue()) {
valueIndexList.add(i);
} else {
- _queryHasMVSelectionOrderBy = true;
+ mvOrderByExpressions.add(_orderByExpressions.get(i));
}
}
+ if (mvOrderByExpressions.size() > 0) {
+ // MV columns should not be part of the selection order by only list
+ throw new UnsupportedOperationException(
Review Comment:
This should be `BadQueryRequestException`, so that we can gracefully handle
it if necessary.
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java:
##########
@@ -127,14 +125,22 @@ private Comparator<Object[]> getComparator() {
// Compare all single-value columns
int numOrderByExpressions = _orderByExpressions.size();
List<Integer> valueIndexList = new ArrayList<>(numOrderByExpressions);
+ List<OrderByExpressionContext> mvOrderByExpressions = new ArrayList<>();
for (int i = 0; i < numOrderByExpressions; i++) {
if (_orderByExpressionMetadata[i].isSingleValue()) {
valueIndexList.add(i);
} else {
- _queryHasMVSelectionOrderBy = true;
+ mvOrderByExpressions.add(_orderByExpressions.get(i));
Review Comment:
(minor) We may directly throw exception here to have slightly better
performance. IMO no need to gather all MV order-by expressions before throwing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]