Apache spark 尝试将数据帧写入配置单元本机拼花地板表时,未找到类org.apache.spark.sql.hive.execution.HiveFileFormat$$anon$1

Apache spark 尝试将数据帧写入配置单元本机拼花地板表时,未找到类org.apache.spark.sql.hive.execution.HiveFileFormat$$anon$1,apache-spark,pyspark,hive,bigdata,Apache Spark,Pyspark,Hive,Bigdata,形态 蜂箱台 spark.conf.set('spark.sql.hive.convertMetastoreParquet', "true") 插入 spark.sql("create table table_name (ip string, user string) PARTITIONED BY (date date) STORED AS PARQUET") 错误 顺便说一句,插入ORC表是好的。在群集上以客户端模式运行。Spark配置文件夹中是否存在您的hive-site.xml文件 编

形态

蜂箱台

spark.conf.set('spark.sql.hive.convertMetastoreParquet', "true")
插入

spark.sql("create table table_name (ip string, user string) PARTITIONED BY (date date) STORED AS PARQUET")
错误


顺便说一句,插入ORC表是好的。在群集上以客户端模式运行。

Spark配置文件夹中是否存在您的hive-site.xml文件

编辑:

你能试一下吗

Caused by: java.lang.ClassNotFoundException: org.apache.spark.sql.hive.execution.HiveFileFormat$$anon$1

不必事先设置任何配置,也不必运行SQL create语句。

是的,我在使用配置单元、ORC和文本表时没有问题,只使用拼花地板。很抱歉,我还不能留下评论(声誉很低)。我正在更新回复,请尽快检查。saveAsTable不会在配置单元中创建表。只在spark中,我不知道为什么在我的情况下有效。请注意,该错误发生在Spark版本1.X中。我正在使用Spark 2.4.3
Caused by: java.lang.ClassNotFoundException: org.apache.spark.sql.hive.execution.HiveFileFormat$$anon$1
df.write.mode("overwrite").partitionBy("date").saveAsTable("db.table_name")