【问题标题】:One record insert to hive partitioned table一条记录插入到 hive 分区表
【发布时间】:2014-03-27 05:32:28
【问题描述】:

我想在 Hive 分区表中插入一条记录:

表格描述如下:

name                    string                  None                
id                      string                  None                
work_done               string                  None                

# Partition Information      
# col_name              data_type               comment             

work_done               string                  None

该表包含少量记录,我想在表中追加一条新记录。

下面是我写的插入记录的代码。

insert into table work_details_join_part partition (work_done) 
    select 'sammy', 'sam002', 'Assignment' from dual;

写完上面的命令后报错:

SemanticException [Error 10096]: Dynamic partition strict mode requires at least one     static partition column. To turn this off set hive.exec.dynamic.partition.mode=nonstrict

为了避免这种情况,我编写了以下命令,然后执行了我的插入命令,即使这样我还是反复收到同样的错误。

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

请指导我。在此先感谢:)

【问题讨论】:

    标签: hadoop hive


    【解决方案1】:

    也许只是将其重写为非动态插入,例如:

    insert into table work_details_join_part partition (work_done='Assignment') 
    select 'sammy', 'sam002' from dual;
    

    但是,hive 对于单条记录插入来说很糟糕,所以预计性能会很差。还请记住,每次运行此查询时,都会将 1 个带有 1 条记录的单个小文件添加到 hdfs 中,从而使该目录成为一个充满小文件的目录(这真的很糟糕)。

    【讨论】:

    • 非常感谢,但还是不能写静态语句。我的意思是它是不允许在蜂巢中还是我写的查询是错误的。
    猜你喜欢
    • 2018-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-13
    • 1970-01-01
    • 2017-03-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多