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


##########
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:
   I think both of these make sense because without the ordering column being 
returned it would be impossible to determine the ordering logic. If the above 
query is changed to `SELECT v FROM %s.t WHERE k = 0 ORDER BY c LIMIT 10`, then 
the clustering key is not returned.



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