How to UPDATE a value in hive table?

Viewed 4187

I have a flag column in Hive table that I want to update after some processing. I have tried using hive and impala using the below query but it didn't work, and got that it needs to be a kudu table while the table I have is a non-kudu table. Is there a way to update it like this query below ?

UPDATE table_name SET flag_col = 1
where [condition];
2 Answers

Hive doesn't support updates (or deletes), but it supports INSERT INTO, so it is possible to add new rows to an existing table.

> insert overwrite table table_name 
> select *,
 case when [condition] then 1 else flag_col end as flag_col,
 from table_name 

//If you want to use you can add where// > where id <> 1;
Related