【问题标题】:Getting Exception while using Timeline column as Hive Partition Field使用 Timeline 列作为 Hive 分区字段时出现异常
【发布时间】:2019-04-12 15:11:49
【问题描述】:

我正在尝试将数据从普通表加载到 Hive 分区表。

这是我的正常表格语法:

create table x(name string, date1 string);

这是我的新分区表语法:

create table y (name string, date1 string) partitioned by (timestamp1 string);

这是我如何将数据加载到 y:

insert into table y PARTITION(SUBSTR(date1,0,2)) select name, date1 from x;

这是我的例外:

FAILED: ParseException line 1:39 missing ) at '(' near ',' in column name
line 1:51 cannot recognize input near '0' ',' '2' in column name

【问题讨论】:

    标签: sql hadoop hive hive-partitions


    【解决方案1】:

    使用动态分区:

    set hive.exec.dynamic.partition=true; 
    set hive.exec.dynamic.partition.mode=nonstrict;
    
    insert into table y PARTITION(timestamp1) 
    select name, date1, SUBSTR(date1,0,2) as timestamp1  from x;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-16
      相关资源
      最近更新 更多