2

Using Apache Spark :2.3.0 Database : Oracle 12.1

I need some help to resolve or find some alternative options in updating the values of the database table using Spark,but when I went through some Basic Programming code to try whether Update,Delete operations are permitted.I was thrown an Exception/Error as follows:

 Exception in thread "main" org.apache.spark.sql.catalyst.parser.ParseException: 
    mismatched input 'UPDATE' expecting {'(', 'SELECT', 'FROM', 'ADD', 'DESC', 'WITH', 'VALUES', 'CREATE', 'TABLE', 'INSERT', 'DELETE', 'DESCRIBE', 'EXPLAIN', 'SHOW', 'USE', 'DROP', 'ALTER', 'MAP', 'SET', 'RESET', 'START', 'COMMIT', 'ROLLBACK', 'REDUCE', 'REFRESH', 'CLEAR', 'CACHE', 'UNCACHE', 'DFS', 'TRUNCATE', 'ANALYZE', 'LIST', 'REVOKE', 'GRANT', 'LOCK', 'UNLOCK', 'MSCK', 'EXPORT', 'IMPORT', 'LOAD'}(line 1, pos 0)

    == SQL ==
    UPDATE

 S SET PRICEITEM_PARM_VAL ='DUMMY' WHERE PRICEITEM_PARM_CD = 'COUNTRY'
^^^

Could anyone post the alternative options to be used in spark,for the same. And also whether this operations could be performed or not.

ben10
  • 83
  • 1
  • 15

1 Answers1

1

Spark SQL does not perform Update operation as Spark SQL doesn't support transactions yet. Hive supports Update but only on tables that supports transactions.

You can refer to answer of databricks forum https://forums.databricks.com/questions/6007/can-we-use-updatedelete-queries-in-databricks-with.html

talkdatatome
  • 614
  • 1
  • 10
  • 17