Sam
Sam

Reputation: 2605

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:)

Upvotes: 2

Views: 4509

Answers (1)

Bennie Schut
Bennie Schut

Reputation: 185

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).

Upvotes: 1

Related Questions