Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

rjain avatar image
rjain asked ·

CassandraJavaUtil joinWithCassandraTable throwing error for table name with mixed case

I am running Spark Report on spark version 2.4.4 on Cassandra where I am joining two tables and using RDD CassandraJavaUtil javafunctions joinWithCassandraTable with first param of keyspace_name [ all lower case letters ] "abc " and second param of table_name [ mix of lowercase and upper case letters ] "xyZ" , then i am getting error Couldn't find table "xyz" in keyspace "abc". As connector i guess lowers all characters and searching the lowercase letter table name which does not exist in keyspace.

I used escaped character for mixed letter table name "xy\"Z\"" . But still I am getting the same error. Couldn't find table "xyZ" in keyspace "abc". Found similar tables in the keyspace abc.xyZ

How can use the joinWithCassandraTable for mixed letters table name as escaped characters not working for mixed letters table name.

spark-cassandra-connector
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered ·

I've got a feeling that mixed-case keyspace and table names are not supported in some parts of the connector.

I'm going to reach out to the Analytics team here at DataStax and will either get them to respond to directly or I will update my answer. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

[Duplicate post]

0 Likes 0 ·

Hi Erick,

Thanks for your response. One correction in the above question

I used escaped character for mixed letter table name "\"xyZ\"" rather "xy"\Z\"" typo mistake.

Also, attaching exception trace below:

21/07/13 11:43:35 INFO CassandraConnector: Connected to Cassandra cluster.

java.io.IOException: Couldn't find table 'xyZ' in abc - Found similar tables in that keyspace:

abc.xyZ

at com.datastax.spark.connector.cql.Schema$.tableFromCassandra(Schema.scala:430)



0 Likes 0 ·
jaroslaw.grabowski_50515 avatar image
jaroslaw.grabowski_50515 answered ·

Hi! You need to check the table name via cqlsh with

describe keyspace <your keyspace>;

Use the name that you'll find in the output.

If the name is quoted, use the correct casing in joinWithCassandraTable. If the name is not quoted (should be lowercased in that case), use lowercased name in `jwct`.

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hi jaroslaw,

Thanks, I typed describe keyspace payment;

O/P:

CREATE TABLE payment."paymentHistory" (

key text PRIMARY KEY,

"c:code text

)

Tried following Casing in JoinwithCassandraTable API

1) Added the table name ( paymentHistory ) with same casing as its found in describe command output below:

CassandraJavaUtil.javaFunctions(rdd).joinWithCassandraTable("payment","paymentHistory",,,,)

Error :

Caused by: com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: unconfigured table paymenthistory at com.datastax.oss.driver.api.core.servererrors.InvalidQueryException.copy(InvalidQueryException.java)

2) Adding escaped double quote character in tablename ( \"paymentHistory\" )as below:

CassandraJavaUtil.javaFunctions(rdd).joinWithCassandraTable("payment","\"paymentHistory\"",,,,)

Err:

Couldn't find table "paymentHistory" in payment.

payment.paymentHistory

Version:

spark-cass-connector-3.0.0

spark-3.0.1



0 Likes 0 ·