Im trying to insert some rows into cassandra using a batch statement. I have not been able to find any documentation on how to do it with the datastax spark connector. I have tried the following
CassandraConnector(conf).withSessionDo({ session =>
val ps = session.prepare(s"BEGIN BATCH" +
"INSERT INTO test.user_trans (user_id, amount) VALUES(?, ?);" +
"INSERT INTO standing (user_id, position) VALUES (?, ?);" +
"APPLY BATCH" );
val bound = ps.bind(user_id, amount, user_id, position)
session.execute(bound)
});
But the datastax driver gives the following error
com.datastax.driver.core.exceptions.SyntaxError: line 1:6 mismatched input 'BATCHINSERT' expecting K_BATCH (BEGIN [BATCHINSERT] INTO...)
Is it at all possible to do atomic batch update using the datastax spark connector driver?
I'm using the spark-cassandra-connector version 1.6.0-s_2.10 and spark 1.6.1
All other oporations on RDD's and saving single rows to Cassandra works.