[ https://issues.apache.org/jira/browse/CASSANDRA-16224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17276765#comment-17276765 ]
Yifan Cai commented on CASSANDRA-16224: --------------------------------------- Thanks [~Jyothsnakonisa] for fixing the issue. I ran the test locally and can confirm the diff spark job now works with names with uppercase letters. The schema used in the test {code:java} CREATE KEYSPACE keyspace1 WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE keyspace1."TEST" ( pk text, "Col1" text, col2 text, PRIMARY KEY(pk, "Col1") );{code} With the patch, the diff job passes. W/o the patch, it fails with the following error. {code:java} Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Undefined column name col1Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Undefined column name col1 at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:49) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:35) at com.datastax.driver.core.AbstractSession.prepare(AbstractSession.java:97) 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) ... 21 more {code} +1 > 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-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org