Hive hql语句的条件

Hive hql语句的条件,hive,hiveql,Hive,Hiveql,我每天都运行som hql语句,就像 drop table if exists table1; create table table1 as select .... from A; 但有时创建表失败,然后删除我的原始表,而不创建新表 我想用一种更聪明的方式来做这件事 就像这个伪代码 if ( create table table1_tmp as select .... from A; ) then ( drop table table1 ;

我每天都运行som hql语句,就像

drop table if exists table1;
create table table1 as 
select ....
from A; 
但有时创建表失败,然后删除我的原始表,而不创建新表

我想用一种更聪明的方式来做这件事 就像这个伪代码

if ( create table table1_tmp as 
     select .... 
     from A; )
then (    drop table table1 ;
          rename table1_tmp to table1 ;
     )
可以在hql中这样做吗?或者我必须在 pig、spark、python等。

最适合您尝试的操作


您可能需要密切关注HDFS垃圾文件夹,因为我认为在执行
插入覆盖时,底层文件总是移动到
/user//.Trash
,为什么不使用
插入覆盖
?谢谢!为什么我没有想到这一点,请你提出你的建议,让我结束这个问题好吗