如何更新配置单元 table 中的值?
How to UPDATE a value in hive table?
我在 Hive table 中有一个标志列,我想在一些处理后更新它。我已经尝试使用 hive 和 impala 使用下面的查询但是它没有用,并且知道它需要是一个 kudu table 而我的 table 是一个非 kudu table。有没有办法像下面的查询一样更新它?
UPDATE table_name SET flag_col = 1
where [condition];
用计算值覆盖整个 table,所有其他列保持原样:
insert overwrite table table_name
select col1, col2, ..., coln,
case when [condition] then 1 else flag_col end as flag_col,
colO,
colP...
from table_name ;
阅读文档以了解有关分区 tables 等的更多详细信息:https://docs.cloudera.com/documentation/enterprise/5-8-x/topics/impala_insert.html
Hive 不支持更新(或删除),但它支持 INSERT INTO,因此可以向现有 table.
添加新行
> insert overwrite table table_name
> select *,
case when [condition] then 1 else flag_col end as flag_col,
from table_name
//If you want to use you can add where// > where id <> 1;
我在 Hive table 中有一个标志列,我想在一些处理后更新它。我已经尝试使用 hive 和 impala 使用下面的查询但是它没有用,并且知道它需要是一个 kudu table 而我的 table 是一个非 kudu table。有没有办法像下面的查询一样更新它?
UPDATE table_name SET flag_col = 1
where [condition];
用计算值覆盖整个 table,所有其他列保持原样:
insert overwrite table table_name
select col1, col2, ..., coln,
case when [condition] then 1 else flag_col end as flag_col,
colO,
colP...
from table_name ;
阅读文档以了解有关分区 tables 等的更多详细信息:https://docs.cloudera.com/documentation/enterprise/5-8-x/topics/impala_insert.html
Hive 不支持更新(或删除),但它支持 INSERT INTO,因此可以向现有 table.
添加新行> insert overwrite table table_name
> select *,
case when [condition] then 1 else flag_col end as flag_col,
from table_name
//If you want to use you can add where// > where id <> 1;