[
https://issues.apache.org/jira/browse/CASSANDRA-8286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tyler Hobbs updated CASSANDRA-8286:
-----------------------------------
Attachment: 8286-2.0.txt
8286-trunk.txt
8286-2.1.txt
In 2.0, the problem was in {{SelectStatement.processOrderingClause()}} where
{{ColumnIdentifier.Raw}} instances were being compared with
{{ColumnIdentifier}} instances.
In 2.1 and trunk, the behavior of {{processOrderingClause()}} was changed, so
that problem didn't appear. However, there were two additional issues:
First, in {{Selection.usingFunctions()}} simply checked {{instanceof
ColumnIdentifier}}, which is false for {{ColumnIdentifier.Raw}}, causing all
selections to be treated as function/field selections
({{SelectionWithFunctions}}).
Second, there was an existing bug with {{SelectionWithFunctions}}. In
{{Selection.addColumnForOrdering()}}, the internal list of {{columns}} is
updated, which works for {{SimpleSelection}}, but is insufficient for
{{SelectionWithFunctions}}, which depends on its pre-built list of
{{Selectors}}. So, if there were any functions or field selections, {{ORDER
BY}} columns would not be properly added to the list of selections. Since the
previously mentioned bug resulted in all selections being
{{SelectionWithFunctions}}, the normal selection case was also broken.
The 2.1 and trunk patches override {{addColumnForOrdering()}} in
{{SelectionWithFunctions}} to update the selectors, and I pushed an [additional
dtest|https://github.com/riptano/cassandra-dtest/commit/da86a8eae38179c12b3576ec3d4beaaa0750144c]
to cover selecting functions with {{ORDER BY}} clauses.
> Regression in ORDER BY
> ----------------------
>
> Key: CASSANDRA-8286
> URL: https://issues.apache.org/jira/browse/CASSANDRA-8286
> Project: Cassandra
> Issue Type: Bug
> Reporter: Philip Thompson
> Assignee: Tyler Hobbs
> Labels: cql
> Fix For: 2.0.12, 2.1.3
>
> Attachments: 8286-2.0.txt, 8286-2.1.txt, 8286-trunk.txt
>
>
> The dtest {{cql_tests.py:TestCQL.order_by_multikey_test}} is now failing in
> 2.0:
> http://cassci.datastax.com/job/cassandra-2.0_dtest/lastCompletedBuild/testReport/cql_tests/TestCQL/order_by_multikey_test/history/
> This failure began at the commit for CASSANDRA-8178.
> The error message reads
> {code}======================================================================
> ERROR: order_by_multikey_test (cql_tests.TestCQL)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/Users/philipthompson/cstar/cassandra-dtest/dtest.py", line 524, in
> wrapped
> f(obj)
> File "/Users/philipthompson/cstar/cassandra-dtest/cql_tests.py", line 1807,
> in order_by_multikey_test
> res = cursor.execute("SELECT col1 FROM test WHERE my_id in('key1',
> 'key2', 'key3') ORDER BY col1;")
> File "/Library/Python/2.7/site-packages/cassandra/cluster.py", line 1281,
> in execute
> result = future.result(timeout)
> File "/Library/Python/2.7/site-packages/cassandra/cluster.py", line 2771,
> in result
> raise self._final_exception
> InvalidRequest: code=2200 [Invalid query] message="ORDER BY could not be used
> on columns missing in select clause."{code}
> and occurs at the query {{SELECT col1 FROM test WHERE my_id in('key1',
> 'key2', 'key3') ORDER BY col1;}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)