【问题标题】:hive pareseexception while creating table from df从df创建表时出现hive pareseexception
【发布时间】:2021-09-03 08:10:12
【问题描述】:

我正在使用 spark 读取 CSV 文件,并使用 sparl JDBC Hive 将 DF 作为表存储在 HIVE 中。

val df = spark.read.format("csv").load("PATH_TO_CSV");
df.write
.format("jdbc")
.option("url", "jdbc:hive2://127.0.0.1:10000/default")
.option("dbtable", "student2")
.option("user", "hive")
.option("password", "hive")
.mode(SaveMode.Overwrite).save;

我在 spark shell 中遇到异常,不知道为什么会遇到此异常

    org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: ParseException line 1:25 cannot recognize input near '"_c0"' 'TEXT' ',' in column name or primary key or foreign key
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:279)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:265)
at org.apache.hive.jdbc.HiveStatement.runAsyncOnServer(HiveStatement.java:303)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:244)
at infoworks.tools.hive.HiveUtils.execStmts(HiveUtils.java:506)
at infoworks.tools.hive.HiveUtils.createHiveTable(HiveUtils.java:740)

谁能帮助我为什么会遇到上述异常?

【问题讨论】:

    标签: scala apache-spark hive


    【解决方案1】:

    您能否也分享一下您尝试插入到 HIVE 表中的示例数据?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-25
      • 2019-06-23
      • 1970-01-01
      • 2020-09-07
      • 1970-01-01
      • 2013-01-16
      相关资源
      最近更新 更多