Hive Unlock All Partitions

Looks like there is no good way to unlock all partitions on a hive table. That means you have to manually unlock each partition. A big pain in the butt.

This little nifty ruby snippet helps you get the unlock table statements that you can paste on your Hive CLI.

irb> s = Date.new(2014,03,01) # The start date of the partitions
irb> e = Date.new(2014,05,01) # The end date of the partitions
irb> (s..e).each {|x| puts "unlock table your_table partition(dt='#{x}');"}
unlock table your_table partition(dt='2014-04-01');
unlock table your_table partition(dt='2014-04-02');
..
unlock table your_table partition(dt='2014-05-01');
 
114
Kudos
 
114
Kudos

Now read this

Creating Presentations with Reveal.js

Late last year, I gave a talk at the Sift Science office in San Francisco on “Hadoop at Lookout - how Lookout uses the hadoop infrastructure to power internal analytics”. I used Reveal.js to present the talk in my browser! Reveal.js is a... Continue →