phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [phoenix] comnetwork commented on a change in pull request #444: PHOENIX-5148
Date Fri, 15 Mar 2019 15:52:07 GMT
comnetwork commented on a change in pull request #444: PHOENIX-5148

 File path: phoenix-core/src/main/java/org/apache/phoenix/compile/
 @@ -9,29 +9,37 @@
 package org.apache.phoenix.compile;
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
+import org.apache.hadoop.hbase.util.Pair;
 import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
-import org.apache.phoenix.execute.TupleProjector;
+import org.apache.phoenix.compile.OrderByCompiler.OrderBy;
 import org.apache.phoenix.expression.CoerceExpression;
 import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.expression.KeyValueColumnExpression;
 import org.apache.phoenix.expression.LiteralExpression;
+import org.apache.phoenix.expression.OrderByExpression;
 import org.apache.phoenix.expression.ProjectedColumnExpression;
 import org.apache.phoenix.expression.RowKeyColumnExpression;
 import org.apache.phoenix.expression.RowValueConstructorExpression;
 import org.apache.phoenix.expression.function.FunctionExpression.OrderPreserving;
 import org.apache.phoenix.expression.function.ScalarFunction;
 import org.apache.phoenix.expression.visitor.StatelessTraverseAllExpressionVisitor;
 import org.apache.phoenix.expression.visitor.StatelessTraverseNoExpressionVisitor;
+import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.schema.PTable;
-import org.apache.phoenix.schema.SortOrder;
+import org.apache.phoenix.schema.TableRef;
 import org.apache.phoenix.util.ExpressionUtil;
 Review comment:
   There are mainly three changes for the class `OrderPreservingTracker`:
   1. I added a `getInputOrderBys` method to determine the input `OrderBys` by the combination
of `innerQueryPlan`'s output `OrderBys` , `GroupBy` of current QueryPlan and the `rowKeyColumns`
of current table.
   2. Because the innerQueryPlan may have multiple output OrderBys(for `SortMergeJoinPlan`),
so I extracted many stateful memeber variables in `OrderPreservingTracker`(such as `orderPreservingTrackInfos`,
`isOrderPreserving` and `isReverse` etc.) to a new inner class `TrackOrderByContext`, `TrackOrderByContext`
is used to track if a single Input OrderBy matchs the target OrderByExpressions in `OrderPreservingTracker.isOrderPreserving()`
method, and once we found a `TrackOrderByContext`  satisfied `isOrderPreserving()`,
   `OrderPreservingTracker.selectedTrackOrderByContext` member variable is set to this `TrackOrderByContext`,
then we can use this `selectedTrackOrderByContext` to implement the `OrderPreservingTracker.getOrderPreservingTrackInfos`
and `OrderPreservingTracker. isReverse` methods etc.
   BTW. at most only one `TrackOrderByContext` can meet `isOrderPreserving` is true.
   3. I added `ascending` and `nullsLast` to the inner class` Info` , and extracted complete
   ordering information in `Info` class by the inner `TrackOrderPreservingExpressionVisitor`
class, so we can  inferring alignment between the target OrderByExpressions and the input
OrderBys  based on `Info` in  `TrackOrderByContext.doTrack` method, not on the row keys
like the  original `OrderPreservingTracker.track` method does.

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:

With regards,
Apache Git Services

View raw message