Hive支援Update和Delete語句

2021-09-26 03:36:49 字數 1181 閱讀 4054

文件說了hive從0.14開始支援的update和delete語句,我使用的hive是1.2.1版本。首先在hive-site.xml裡配置如下屬性:

hive.optimize.sort.dynamic.partition

false

hive.support.concurrency

true

hive.enforce.bucketing

true

hive.exec.dynamic.partition.mode

nonstrict

hive.txn.manager

org.apache.hadoop.hive.ql.lockmgr.dbtxnmanager

hive.compactor.initiator.on

true

hive.compactor.worker.threads

1

然後建表語句如下,注意表需要分桶,儲存格式為orc,以及新增事務屬性:

create table test_update(id int ,name string )clustered by (id) into 2 buckets stored as orc tblproperties('transactional'='true');
現在開始測試:

插入幾條記錄:insert into table test_update values (1,『row1』),(2,『row2』),(3,『row3』);

然後執行update語句:update test_update set name = 『xyz』 where id = 1;

執行delete語句:delete from test_update where id = 3;

hive 支援更新

因為業務要求,需要對hive表進行delete,在官網查詢後,發現update和delete是一類問題。在此總結下如何實現hive表的delete和update。首先,先看下官網關於update和delete的相關說明,使用注意事項也請參考官網說明,這裡只介紹如何實現相關功能。綜合上述資訊,hive...

De4Dot Reflector 支援多種反混淆

de4dot reflector 支援多種反混淆 官網 原始碼 使用方法 通過cmd命令方式進入 1 f 2 de4dot v3 1 de4dot12306訂票助手.exe 在對應目錄下生成乙個 12306訂票助手 cleaned.exe 然後再採用 reflector.exe 進行反編譯。額外補充...

Hive 的事務支援

hive 開始支援事務,是在 hive 0.14 之後。hdfs 的檔案,只能允許新建,刪除,對檔案中的內容進行更新,不允許單條修改。hive 的檔案儲存是基於 hdfs 檔案存在的,所以原則上不會直接對 hdfs 做檔案內容的事務更新,只能是採取另外的手段來完成。即用 hdfs 檔案作為原始資料,...