Skip to content

Instantly share code, notes, and snippets.

@belenaj
Created September 9, 2020 13:01
Show Gist options
  • Save belenaj/0eb444e8807c1d7074d7495c176e5774 to your computer and use it in GitHub Desktop.
Save belenaj/0eb444e8807c1d7074d7495c176e5774 to your computer and use it in GitHub Desktop.
recreate all partitions in hive table
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