简体   繁体   中英

One record insert to hive partitioned table

I want to insert one record to a hive partitioned table:

The table desc is given below:

name                    string                  None                
id                      string                  None                
work_done               string                  None                

# Partition Information      
# col_name              data_type               comment             

work_done               string                  None

The table consist few records and I want want to append a new record to the table.

Given below is the code I write to insert record.

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

After writing the above command I get an error:

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

To avoid this I wrote the following command and then executed my insert command, Even then I get the same error repeatedly.

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

Please do guide me. Thanks in advance:)

Perhaps just rewrite it to be a non-dynamic insert like:

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

However hive is terrible for single record inserts so expect really bad performance. Also keep in mind each time you run this query 1 single small file with 1 record will be added to hdfs making this a directory full of tiny files (this is really bad).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM