Help Center/ MapReduce Service/ Component Operation Guide (LTS)/ Using Spark/Spark2x/ Common Issues About Spark/ Spark SQL and DataFrame/ How Do I Rectify the Exception Occurred When I Perform an Operation on the Table Named table?
Updated on 2024-10-09 GMT+08:00

How Do I Rectify the Exception Occurred When I Perform an Operation on the Table Named table?

Question

After a table named table is created, the following error message is displayed when you run drop table table or perform other operations.

16/07/12 18:56:29 ERROR SparkSQLDriver: Failed in [drop table table]
java.lang.RuntimeException: [1.1] failure: identifier expected
table
^
at scala.sys.package$.error(package.scala:27)
at org.apache.spark.sql.catalyst.SqlParserTrait$class.parseTableIdentifier(SqlParser.scala:56)
at org.apache.spark.sql.catalyst.SqlParser$.parseTableIdentifier(SqlParser.scala:485)

Answer

table is a keyword of Spark SQL and cannot be used as a table name. Do not name a table table.