蜂巢按时间划分

我要实施

alter table dos_sourcedata add partition (data = to_date (current_timestamp ()));

在蜂巢中

每天在特定时间运行此语句。 但这总是错误的。

zfau1000 回答:蜂巢按时间划分

如果要使用alter table创建空分区,请使用值而不是表达式,如下所示:

alter table mytable add partition (partition_date='2020-04-01');

在使用插入覆盖表分区加载数据时,可以动态创建分区,在这种情况下,可以在查询中使用表达式:

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;

insert overwrite table mytable partition (partition_date)
select 
      col_1,...
      col_n,current_date --partition column is the last one
  from ...

使用current_date代替to_date (current_timestamp ())

本文链接:https://www.f2er.com/2558656.html

大家都在问