How to the update records in Hive?

Most of us might have worked on Hive in projects. But we never get a requirement to update records in Hive because business never requires to update records in Hive. So most people don't know the updating records procedure in Hive. In this we will get know what are all the preconditions required to update records in Hive and how to do it.


Precondition to update records in Hive:

  • Below properties must be set as specified:


set hive.enforce.bucketing=true (Not required as from Hive version 2.0)

set hive.exec.dynamic.partition.mode=nonstrict

set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager

set hive.compactor.initiator.on=true

set hive.compactor.worker.threads=2

These properties can be set on hive command line using above commands or we can set in hive-site.xml file as below:

  • Table must be stored as ORC file format.
  • Table must be bucketed
  • The property transactional¬†of the table must be set to true.


Let's see how to create a table in Hive and updating the rows.

To create employee table in Hive use below command:

CREATE TABLE employee (
emp_id int,
name string
TBLPROPERTIES ("transactional"="true");


To update records use below command:

UPDATE employee SET name = "Mark Berg" WHERE emp_id = 1;


1 thought on “How to the update records in Hive?”

  1. The subsequent time I read a blog, I hope that it doesnt disappoint me as much as this one. I imply, I do know it was my option to read, however I actually thought youd have one thing fascinating to say. All I hear is a bunch of whining about something that you would fix for those who werent too busy searching for attention.

Leave a Reply

Your email address will not be published. Required fields are marked *