scala - How to preserve order of columns in cassandra -
i have 2 tables in cassandra:
create table table1 (           name text primary key,           grade text,            labid list<int>);  create table table2(           name text primary key,           deptid list<int>             grade text,);   for example:
val result: rdd[string, string, list[int]] = myfunction(); result.savetocassandra(keyspace, table1)   it working fine. in case of using below line:
result.savetocassandra(keyspace, table2)   m getting type of error : com.datastax.spark.connector.types.typeconversionexception: cannot convert object test_data of type class java.lang.string list[anyref]
is there solution using somecolumns satisfy both tables[we don't know table executed]. eg:
result.savetocassandra(keyspace, table, somecolumns(....))?      
you arguments should in different order because tables have different column types:
val result: rdd[string, string, list[int]] = myfunction(); val reorder: rdd[string, list[int], string] = result.map(r => r._1, r._3, r._2) reorder.savetocassandra(keyspace, table2)      
Comments
Post a Comment