hadoop - how to update multiple columns in hive table which is bucketed and in orc format -


i can update single column can't update multiple columns referenced table.

i enabled acid properties support hive (1.2.1 ) table updates.

i have 2 tables,

table1:

schema:

create table table1(emp_id int,emp_name string, etime timestamp);

data:

emp_id | emp_name | etime

1 | david | 2016-01-08 12:27:30

2 | john | 2016-01-08 12:27:45

table 2

schema :

create table table2(emp_id int,emp_name string,etime timestamp) set clustered (emp_id) 4 buckets stored orc tblproperties('transactional'='true');

data:

emp_id | emp_name | etime

1 | davi | 2016-01-08 12:02:30

2 | johny | 2016-01-08 11:20:45

3 | kiran | 2016-01-08 11:01:36

now want update columns in table2 based on table1 data comparing emp_id of both tables. want output following

table2:

emp_id | emp_name | etime

1 | david | 2016-01-08 12:27:30

2 | john | 2016-01-08 12:27:45

3 | kiran | 2016-01-08 11:01:36

try this:

update table2 set t2.etime = t1.etime table2 t2 left outer join table1 t1 on t1.emp_id = t2.emp_id t1.emp_id not null


Comments