How to delete and update a record in Hive

后端 未结 15 1329
梦如初夏
梦如初夏 2020-11-28 19:26

I have installed Hadoop, Hive, Hive JDBC. which are running fine for me. But I still have a problem. How to delete or update a single record using Hive because delete or upd

15条回答
  •  死守一世寂寞
    2020-11-28 20:02

    There are few properties to set to make a Hive table support ACID properties and to support UPDATE ,INSERT ,and DELETE as in SQL

    Conditions to create a ACID table in Hive. 1. The table should be stored as ORC file .Only ORC format can support ACID prpoperties for now 2. The table must be bucketed

    Properties to set to create ACID table:

    set hive.support.concurrency =true;
    set hive.enforce.bucketing =true;
    set hive.exec.dynamic.partition.mode =nonstrict
    set hive.compactor.initiator.on = true;
    set hive.compactor.worker.threads= 1;
    set hive.txn.manager = org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
    

    set the property hive.in.test to true in hive.site.xml

    After setting all these properties , the table should be created with tblproperty 'transactional' ='true'. The table should be bucketed and saved as orc

    CREATE TABLE table_name (col1 int,col2 string, col3 int) CLUSTERED BY col1 INTO 4 
    BUCKETS STORED AS orc tblproperties('transactional' ='true');
    

    Now the Hive table can support UPDATE and DELETE queries

提交回复
热议问题