[ https://issues.apache.org/jira/browse/PHOENIX-1826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14493021#comment-14493021 ]
James Taylor commented on PHOENIX-1826: --------------------------------------- The group by key is built in the order that the group by expressions are listed while before they were ordered by the column position of the first column encountered in the expression. We make no guarantee on the order of groups, though (unless there's an order by), so this is really just to have a predictable order for tests. So the group by keys were swapped so that the results appear in the same order they did before. Any thoughts on the FIXME comment I added to the visitor in OrderPreservingTracker regarding a ProjectedColumnExpression? {code} + @Override + public Info visit(ProjectedColumnExpression node) { + if (projector == null) { + return super.visit(node); + } + Expression expression = projector.getExpressions()[node.getPosition()]; + // FIXME: prevents infinite recursion for union all in subquery, but + // should a ProjectedColumnExpression be used in this case? Wouldn't + // it make more sense to not create this wrapper in this case? + if (expression == node) { + return super.visit(node); + } + return expression.accept(this); + } + {code} > Implement TrackOrderPreservingExpressionCompiler as Expression visitor > instead of ParseNode visitor > --------------------------------------------------------------------------------------------------- > > Key: PHOENIX-1826 > URL: https://issues.apache.org/jira/browse/PHOENIX-1826 > Project: Phoenix > Issue Type: Task > Reporter: James Taylor > Attachments: PHOENIX-1826-combined.patch, PHOENIX-1826.patch, > PHOENIX-1826.patch > > > We currently traverse the ORDER BY ParseNodes in > TrackOrderPreservingExpressionCompiler to determine if the rows will be > ordered in row key order. This complicates supporting ORDER BY expressions > that are an ordinal position (PHOENIX-1749), since it's a fair bit of code to > manufacture a ParseNode when wildcards are used in the select. We should > consider writing this visitor as an Expression instead and then using ordinal > position would be easy as we could index into the RowProjector to get an > Expression. See ViewWhereExpressionVisitor in CreateTableCompiler for an > example. -- This message was sent by Atlassian JIRA (v6.3.4#6332)