Hive 是否可以更新配置单元中的复杂数据类型?e、 x:映射、数组、结构
我想知道: 是否可以更新配置单元中的复杂数据类型?e、 x:映射、数组、结构 使用ACID表和更新语法 e、 g.我们有一张桌子:Hive 是否可以更新配置单元中的复杂数据类型?e、 x:映射、数组、结构,hive,hiveql,Hive,Hiveql,我想知道: 是否可以更新配置单元中的复杂数据类型?e、 x:映射、数组、结构 使用ACID表和更新语法 e、 g.我们有一张桌子: CREATE TABLE complex_nested_types_update_array_map ( person_id int, person_info MAP <STRING, ARRAY <STRING>>) CLUSTERED BY (person_id) INTO 2 BUCKETS STORED AS ORC TBLPROPE
CREATE TABLE complex_nested_types_update_array_map (
person_id int,
person_info MAP <STRING, ARRAY <STRING>>)
CLUSTERED BY (person_id) INTO 2 BUCKETS STORED AS ORC TBLPROPERTIES ("transactional"="true");
因此,我们的数据在表中:
select * from complex_nested_types_update_array_map order by person_id;
1 {"John":["+44801123311","+120342234","+230342234","+3303422434"]}
2 {"Tomas":["+380342234","+230342234","+230342234","+530342234"]}
是否可以在不覆盖整行的情况下更新特定数组元素
e、 g:
更新数据:
select * from complex_nested_types_update_array_map order by person_id;
1 {"John":["+44801123311","+120342234","+230342234","+3303422434"]}
2 {"AAron":["edited","edited","+230342234","+3303422434"]}
但我们只能更新数组的[2]或[3]元素吗?使用插入覆盖选项
UPDATE complex_nested_types_update_array_map SET
person_info = map('AAron', array("edited", "edited", "+230342234", "+3303422434"))
WHERE person_id = 2;
select * from complex_nested_types_update_array_map order by person_id;
1 {"John":["+44801123311","+120342234","+230342234","+3303422434"]}
2 {"AAron":["edited","edited","+230342234","+3303422434"]}
insert overwrite table complex_nested_types_update_array_map
select person_id,map('AAron', array("edited", "edited", "+230342234", "+3303422434")) as person_info
from complex_nested_types_update_array_map
WHERE person_id = 2
union all
select person_id,person_info
from complex_nested_types_update_array_map
where person_id<>2