mike-tr-adamson commented on code in PR #2673:
URL: https://github.com/apache/cassandra/pull/2673#discussion_r1341243973


##########
src/java/org/apache/cassandra/cql3/statements/SelectStatement.java:
##########
@@ -1133,13 +1149,13 @@ public SelectStatement prepare(ClientState state, 
boolean forView) throws Invali
             List<Selectable> selectables = 
RawSelector.toSelectables(selectClause, table);
             boolean containsOnlyStaticColumns = selectOnlyStaticColumns(table, 
selectables);
 
-            StatementRestrictions restrictions = prepareRestrictions(state, 
table, bindVariables, containsOnlyStaticColumns, forView);
+            List<Ordering> orderings = getOrderings(table);
+            StatementRestrictions restrictions = prepareRestrictions(state, 
table, bindVariables, orderings, containsOnlyStaticColumns, forView);
 
             // If we order post-query, the sorted column needs to be in the 
ResultSet for sorting,
             // even if we don't ultimately ship them to the client 
(CASSANDRA-4911).
-            Map<ColumnMetadata, Boolean> orderingColumns = 
getOrderingColumns(table);
-            Set<ColumnMetadata> resultSetOrderingColumns = 
restrictions.keyIsInRelation() ? orderingColumns.keySet()
-                                                                               
           : Collections.emptySet();
+            Map<ColumnMetadata, Ordering> orderingColumns = 
getOrderingColumns(orderings);
+            Set<ColumnMetadata> resultSetOrderingColumns = 
getResultSetOrdering(restrictions, orderingColumns);

Review Comment:
   This is a bug in the distributed test code. Specifically, 
`RowUtil.toQueryResult`. This is incorrectly using `rows.result.metadata.names` 
instead of `rows.result.metadata.requestNames()`. The `requestNames` method 
specifically removes any columns that have not been requested. I have raised 
CASSANDRA-18892 and attached a fix patch there for this.



-- 
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]

Reply via email to