You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Yifan Cai (Jira)" <ji...@apache.org> on 2021/02/02 18:19:00 UTC
[jira] [Updated] (CASSANDRA-16224) InvalidQueryException: Order by
on unknown column From cassandra-diff
[ https://issues.apache.org/jira/browse/CASSANDRA-16224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yifan Cai updated CASSANDRA-16224:
----------------------------------
Reviewers: Marcus Eriksson, Yifan Cai (was: Yifan Cai)
> InvalidQueryException: Order by on unknown column From cassandra-diff
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-16224
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16224
> Project: Cassandra
> Issue Type: Bug
> Components: Tool/diff
> Reporter: Yifan Cai
> Assignee: Jyothsna Konisa
> Priority: Normal
> Labels: pull-request-available
>
> Diff job fails with the following error,
> {code:java}
> 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)
> {code}
> 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.
> {code:java}
> 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);
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org