'How to bind variables inside collection literals in Cassandra using Scala?
I am trying to bind data to map type column in Cassandra using my Spark Scala application.
val updateTemplate = s"""UPDATE test_ks.test_table_ttl USING TTL 5
|SET ttl_col = ttl_col + {:mapKey : (':value1', ':value2')}
|WHERE consumer_id=:consumer_id""".stripMargin
val prep_statement: PreparedStatement = cqlSession.prepare(updateTemplate)
This is throwing an error.
Invalid map literal for ttl_col: bind variables are not supported inside collection literals
My DDL for Cassandra table is like this.
CREATE KEYSPACE test_ks
WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 3};
CREATE TABLE test_ks.test_table_ttl (
consumer_id TEXT PRIMARY KEY,
ttl_col map<text, frozen<tuple<text, text>>>
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
