正在从 Hive 目标中删除记录 table

Deleting records from Hive Target table

我有一个目标 table A,我想从中删除 3 条重复记录。我发现 delete from table where id = 1 在 Hive 中不起作用(这很简单)

反过来,我现在做的是:

Step 1: Create a copy table of the target table
Step 2: Insert into copy table select * from target where id not in (1,2,3)
step 3: Truncate target table
step 4: Insert into target table select * from copy table

有没有比这更直接的方法?

您可以从自身插入覆盖:

--for partitioned table
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;

--If you are on Qubole
set hive.allow.move.on.s3=true;

insert overwrite table target partition (col1,col2)
select * from target where id not in (1,2,3)