Context :
I need to change the order of my primarey key
PRIMARY KEY (a, b) --> PRIMARY KEY (b,a)
But in cassandra I can't just alter PRIMARY KEY like this : alter composite primary key in cassandra CQL 3.0
So, I just want to move data from the old table to a new table I've created. Since the number of rows is huge I need to use Spark.
Data "in" :
I get the data like this from the old table:
JavaRDD<CassandraRow> initialRDD;
Question :
Id it possible to directly save it back to the new table since the row itself didn't change?
What I managed to do :
I could do this but it seems absurd to map from CassandraRow to CassandraRow
javaFunctions(initialRDD).writerBuilder("targetKeyspace", "targetTable", mapToRow(CassandraRow.class)).saveToCassandra();
thus it's prompting me an error :
Some primary key columns are missing in RDD or have not been selected: ...