如何使用 HQL 替换 Hive 数据库中的行

How to replace rows in Hive database using HQL

我正在尝试过滤掉一个配置单元数据库 df

project  schedule  timestamp
p1       1         t1
p1       2         t1
p1       3         t1
p2       1         t2
p2       2         t2

我想替换此数据中的行,使得结果数据集类似于:

project schedule timestamp
p1      2        t1
p1      3        t1
p2      1        t2
p2      2        t2

我尝试使用的查询是:

Insert overwrite table df Select * from df where project != p1 and schedule != 1.

这不起作用,因为我过滤掉了项目 p1 的所有行。我觉得我在这里遗漏了一些非常微不足道的东西。

我觉得你想要的逻辑是:

where project <> 'p1' or schedule <> 1

或等效地:

where not (project = 'p1' and schedule = 1)