val hiveDeptDF = sqlContext.read.table("emp_test.emp")
我要读取hive中emp_test中的emp表,报错不能包含“.”
Exception in thread "main" org.apache.spark.sql.AnalysisException: Specifying database name or other qualifiers are not allowed for temporary tables. If the table name has dots (.) in it, please quote the table name with backticks (`).;
at org.apache.spark.sql.catalyst.analysis.Catalog$class.getTableName(Catalog.scala:70)
at org.apache.spark.sql.catalyst.analysis.SimpleCatalog.getTableName(Catalog.scala:82)
at org.apache.spark.sql.catalyst.analysis.SimpleCatalog.lookupRelation(Catalog.scala:104)
at org.apache.spark.sql.DataFrameReader.table(DataFrameReader.scala:338)
at Hive2Rdbms$.main(Hive2Rdbms.scala:16)
at Hive2Rdbms.main(Hive2Rdbms.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
我加上反引号后,又显示找不到该表。
hive库本身没问题