Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
Availability - Process Crash
-
Normal
-
Low Hanging Fruit
-
Adhoc Test
-
All
-
None
-
Description
Diff job fails with the following error,
Caused by: shaded.com.datastax.driver.core.exceptions.InvalidQueryException: Order by on unknown column <column_name> at shaded.com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:49) at shaded.com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:35) at shaded.com.datastax.driver.core.AbstractSession.prepare(AbstractSession.java:97) at mme.cassandraclient.SessionWrapper.prepare(SessionWrapper.java:215) at org.apache.cassandra.diff.DiffCluster.getFullStatement(DiffCluster.java:272) at org.apache.cassandra.diff.DiffCluster.getStatementForTable(DiffCluster.java:204) at org.apache.cassandra.diff.DiffCluster.keyReader(DiffCluster.java:188) at org.apache.cassandra.diff.DiffCluster.fetchPartitionKeys(DiffCluster.java:125) at org.apache.cassandra.diff.DiffCluster.lambda$getPartitionKeys$0(DiffCluster.java:114) at org.apache.cassandra.diff.RetryStrategy.retry(RetryStrategy.java:21) at org.apache.cassandra.diff.DiffCluster.getPartitionKeys(DiffCluster.java:113)
The cause is that when building the select query, the ordered-by column names are not quoted. The server only sees the field names in lowercase, and it is unable to recognize.
A simple unit test to prove that the field name needs to be quoted in the query builder in order to have the built query preserve the quotes.
query = "SELECT * FROM t WHERE a='foo' ORDER BY \"bCol\" DESC;"; select = select().from("t").where(eq("a", "foo")).orderBy(desc("\"bCol\"")); assertEquals(select.toString(), query);
Attachments
Issue Links
- relates to
-
CASSANDRA-15537 4.0 quality testing: Local Read/Write Path: Upgrade and Diff Test
- Resolved
- links to