本文介绍了如何遍历蜂巢中的所有分区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更新所有分区中列的值.在我发现insert overwrite
可以用来更新数据之前.我目前的说法是
I want to update column's value in all partitions. Before I found insert overwrite
can be used to update data. My current statement is
insert OVERWRITE table s_job PARTITION(pt = '20190101') select case job_name when 'Job' then 'system' end from s_job;
但是,它必须指定某些分区.我想要的是更新所有分区中的值,我不知道该怎么做.有没有办法使用Hive SQL遍历Hive中的所有分区?非常感谢.
However, it must specify certain partition. What I want is to update the value in all partitions, I don't know how to do. Is there a way using hive sql to go through all partitions in hive? Thank you so much.
推荐答案
使用动态分区:
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
insert OVERWRITE table s_job PARTITION(pt)
select --Add all columns in their original order
col1,
col2,
...
coln,
case job_name when 'Job' then 'system' end as job_name,
pt --partition column should be the last one
from s_job;
这篇关于如何遍历蜂巢中的所有分区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!