ChinmaySKulkarni commented on a change in pull request #736: PHOENIX-5698
Phoenix Query with RVC IN list expression generates wron…
URL: https://github.com/apache/phoenix/pull/736#discussion_r397381557
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/expression/InListExpression.java
##########
@@ -330,4 +342,98 @@ public String toString() {
public InListExpression clone(List<Expression> l) {
return new InListExpression(l, this.rowKeyOrderOptimizable);
}
+
+ public static List<InListColumnKeyValuePair>
getSortedInListColumnKeyValuePair(List<Expression> children,
+
boolean isStateless) {
+ List<InListColumnKeyValuePair> inListColumnKeyValuePairList = new
ArrayList<>();
+ int numberOfColumns = 0;
+
+ for (int i = 0; i < children.size(); i++) {
+ Expression child = children.get(i);
+ if (i == 0) {
+ numberOfColumns = child.getChildren().size();
+ for (int j = 0; j < child.getChildren().size(); j++) {
+ if (child.getChildren().get(j) instanceof
RowKeyColumnExpression) {
+ RowKeyColumnExpression rowKeyColumnExpression =
+
(RowKeyColumnExpression)child.getChildren().get(j);
+ InListColumnKeyValuePair inListColumnKeyValuePair =
+ new
InListColumnKeyValuePair(rowKeyColumnExpression);
+
inListColumnKeyValuePairList.add(inListColumnKeyValuePair);
+ } else {
+ return null;
+ }
+ }
+ } else {
+ if (numberOfColumns != child.getChildren().size()) {
+ // if the number of the PK columns doesn't match number of
values,
+ // it should not sort it in PK position.
+ return null;
+ }
+
+ for (int j = 0; j < child.getChildren().size(); j++) {
+ LiteralExpression literalExpression = (LiteralExpression)
child.getChildren().get(j);
+
inListColumnKeyValuePairList.get(j).addToLiteralExpressionList(literalExpression);
+ }
+ }
+ }
+ Collections.sort(inListColumnKeyValuePairList);
+ return inListColumnKeyValuePairList;
+
+
+ }
+
+ public static List<Expression> getSortedRowValueConstructorExpressionList(
Review comment:
Same here, let's add a comment header for this method.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services