scala - java.util.NoSuchElementException: Column not found ID in table demo.usertable in Cassandra Spark -


i try write rdd[cassandrarow] existing cassandra table using spark-cassandra-connector. here piece of code

val conf = new sparkconf().setappname(getclass.getsimplename)             .setmaster("local[*]")             .set("spark.cassandra.connection.host", host)         val sc = new sparkcontext("local[*]", keyspace, conf) val rdd = sc.textfile("hdfs://hdfs-host:8020/users.csv") val columns = array("id", "firstname", "lastname", "email", "country") val types = array("int", "string", "string", "string", "string") val crdd=rdd.map(p => {             var tokens = p.split(",")             new cassandrarow(columns,tokens)         }) val targetedcolumns = somecolumns.seqtosomecolumns(columns) crdd.savetocassandra(keyspace, tablename, targetedcolumns,  writeconf.fromsparkconf(conf)) 

when run code following exception

exception in thread "main" java.util.nosuchelementexception: column not found id in table demo.usertable 

here actual schema of table

create table usertable (   id int,   country text,   email text,   firstname text,   lastname text,   primary key ((id)) ) 

any suggestion? thanks

keyspace, table , column names case sensitive in cassandra. have tried adjusting code use same case table definition? (for example use 'id' instead of 'id').


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -