Created
September 9, 2020 13:01
-
-
Save belenaj/0eb444e8807c1d7074d7495c176e5774 to your computer and use it in GitHub Desktop.
recreate all partitions in hive table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start='2020-04-01' | |
end='2020-09-09' | |
start=$(date -d $start +%Y%m%d) | |
end=$(date -d $end +%Y%m%d) | |
iter=$start | |
while [[ $iter -le $end ]] | |
do | |
echo $iter | |
day=$(date -d "$iter" +%d) | |
month=$(date -d "$iter" +%m) | |
year=$(date -d "$iter" +%Y) | |
echo $day | |
echo $month | |
echo $year | |
hive -v -f create_partition_in_table.sql" \ | |
--hiveconf year=$year --hiveconf month=$month --hiveconf day=$day; | |
iter=$(date -d "$iter + 1 day" +"%Y%m%d") | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment