标签:exist port 出现 enable sel table alt 字符串 alter
SparkSession.builder().enableHiveSupport().getOrcCreate().sql(Hive_String)
中执行。SparkSession spark = SparkSession.builder().enableHiveSupport().getOrcCreate();
String sql = “ALTER TABLE DB_NAME.TABLE1 DROP IF EXISTS PARTITION(pt_dt=')"+ partition_date +"')";
pt_dt
分区名为小写,若写成PT_DT
,则会报错。String sql = "SELECT ID, "
+" NAME, "
+" pt_dt "
+" FROM DB_NAME.TABLE1 "
+" WHERE pt_dt = '" + partition_date + "'"
if(versionNum==null || versionNum.isEmpty() || "none".equals(versionNum)) {
versionNum = "";
}
String sql = "SELECT ID,"
+" NAME, "
+" pt_dt"
+"FROM DB_NAME.TABLE1 "
+" WHERE pt_dt = '" + partition_date + "'"
其中,字段pt_dt
后没有空格,FROM前也没有空格,sql解析出来会变成pt_dtFROM
,造成语法错误。
标签:exist port 出现 enable sel table alt 字符串 alter
原文地址:https://www.cnblogs.com/JasonCeng/p/12217754.html