I have loaded one of my table in dataframe and trying to save it as hive table
var RddTableName= objHiveContext.sql("select * from tableName")
val dataframeTable = RddTableName.toDF()
dataframeTable.write.format("orc").mode(SaveMode.Overwrite).saveAsTable("test.myTable")
I'm getting below exception org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: cannot find field mytable from [public java.util.ArrayList org.apache.hadoop.hive.serde2.ColumnSet.col]
The above exception is occurring as I was trying to overwrite which looks for existing table "myTable" here(and it is not there ), so to create a new table we have to go for saveMode.Ignore or ErrorIfExists. You can metion Database name in options by mapping its path
首先设置hcontext.sql(“ use database”)您不能将数据库放入saveAsTable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.