- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
issue while inserting data into hive through spark
- Labels:
-
Apache Spark
Created ‎03-22-2017 06:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not able to insert data into hive table through spark
scala> sqlContext.sql("insert into table results_test_hive values('XXXXXXXXXX', 'm:X', 0.0)")
Failed with below error,
org.apache.spark.sql.AnalysisException:
Unsupported language features in query: insert into table results_test_hive values('XXXXXXXXXX', 'm:X', 0.0)
Created ‎03-22-2017 06:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @prsingh, Spark currently doesn't support "insert into feature", you may create dataframe and append to the table.
scala> var data = sqlContext.createDataFrame(Seq(("ZZ", "m:x", 34.0))).toDF("pv", "metric", "value") scala> data.show() scala> data.write.mode("append").saveAsTable("results_test_hive") scala> println(sqlContext.sql("select * from results_test_hive").count())
Created ‎03-22-2017 06:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @prsingh, Spark currently doesn't support "insert into feature", you may create dataframe and append to the table.
scala> var data = sqlContext.createDataFrame(Seq(("ZZ", "m:x", 34.0))).toDF("pv", "metric", "value") scala> data.show() scala> data.write.mode("append").saveAsTable("results_test_hive") scala> println(sqlContext.sql("select * from results_test_hive").count())
Created ‎03-22-2017 12:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the information . I was able to insert after creating the dataframe.
