通过 HQL 更改 hive table 中映射列中的一个键值
change one key-value in map columns in hive table via HQL
我有一个 Hive table,其架构如下,col
是 map
类型:
select
col
from table
col
{"name":"abc", "value":"val_1"}
我需要做的是将 val_1
更改为 val_2
并从中创建另一个 table。
create table table_2 as
select
col -- TODO: need to do something here
from table
有什么建议吗?谢谢!
with t as (select map("name","abc","value","val_1") as col)
select map("name",col["name"],"value","val_2") as col
from t
+--------------------------------+
| col |
+--------------------------------+
| {"name":"abc","value":"val_2"} |
+--------------------------------+
我有一个 Hive table,其架构如下,col
是 map
类型:
select
col
from table
col
{"name":"abc", "value":"val_1"}
我需要做的是将 val_1
更改为 val_2
并从中创建另一个 table。
create table table_2 as
select
col -- TODO: need to do something here
from table
有什么建议吗?谢谢!
with t as (select map("name","abc","value","val_1") as col)
select map("name",col["name"],"value","val_2") as col
from t
+--------------------------------+
| col |
+--------------------------------+
| {"name":"abc","value":"val_2"} |
+--------------------------------+