【发布时间】:2020-09-01 07:42:58
【问题描述】:
我在 Spark 中有一个数据框,我将其作为表格保存在我的配置单元中。但出现以下错误消息。
java.lang.RuntimeException:
com.hortonworks.spark.sql.hive.llap.HiveWarehouseConnector
does not allow create table as select.at scala.sys.package$.error(package.scala:27)
谁能帮我把它保存为蜂巢中的表格。
val df3 = df1.join(df2, df1("inv_num") === df2("inv_num") // Join both dataframes on id column
).withColumn("finalSalary", when(df1("salary") < df2("salary"), df2("salary") - df1("salary"))
.otherwise(
when(df1("salary") > df2("salary"), df1("salary") + df2("salary")) // 5000+3000=8000 check
.otherwise(df2("salary")))) // insert from second dataframe
.drop(df1("salary"))
.drop(df2("salary"))
.withColumnRenamed("finalSalary","salary")
}
}
//below code is not working when I'm executing below command its throwing error as
java.lang.RuntimeException:
com.hortonworks.spark.sql.hive.llap.HiveWarehouseConnector
does not allow create table as select.at scala.sys.package$.error(package.scala:27)
df3.write.
format("com.hortonworks.spark.sql.hive.llap.HiveWarehouseConnector")
.option("database", "dbname")
.option("table", "tablename")
.mode("Append")
.saveAsTable("tablename")
注意:表已在数据库中可用,我正在使用 HDP 3.x。
【问题讨论】:
标签: scala apache-spark hive apache-spark-sql hdp