I am a beginner with Scala and Apache Spark and I am facing the below problem.
I am trying to insert data into a Cassandra table..user (name,favorite_food) using spark SQL.
The code snippet looks like this
val conf = new SparkConf(true)
.set("spark.cassandra.connection.host", "127.0.0.1")
val sc = new SparkContext("local", "test", conf)
val sqlC = new CassandraSQLContext(sc)
sqlC.setKeyspace("myKeySpace")
sqlC.sql("INSERT into user (name,favorite_food) values ('John Doe','brownies')")
However I face the issue Exception in thread "main" java.lang.RuntimeException: [1.13] failure: ``table'' expected but identifier user found
I am running a local instance of Cassandra DB
My Maven POM looks like
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.10</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
My question is; Please can you let me know why I face the below error (The insert statement works perfectly fine on the cassandra shell) Exception in thread "main" java.lang.RuntimeException: [1.13] failure: ``table'' expected but identifier user found
PS : I do know I can use the spark connector provided by datastax to save data to Cassandra, however I want to use Spark SQL...is that possible?
useris a reserved word, if you quote it"user"it may work - RussS