简体   繁体   中英

Update a value in Hive Table

I have gone through some of the Stackoveflow question . but I was not able to do the same.

Hive doesnot support update but a workaround for that is to create partition to table.

How to update a record in Hive?

The update feature in Hive is planned in the next release.

As a workaround , You could try the below :

  1. Add a flag column default as I and a timestamp column
  2. consider partitions as your primary key fields (combination).
  3. whenever a new record (updated ) on this primary key combination set the flag as U.
  4. Write a custom serde class where in only U records are shown.

NOTE : There will be duplicated data , but serde should only show the latest U data corresponding to the latest timestamp in the timestamp column.

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