HIVE-6847: Improve / fix bugs in Hive scratch dir setup (Vaibhav Gumashta reviewed by Jason Dere, Szehon Ho, Thejas Nair, Venki Korukanti)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1622556 13f79535-47bb-0310-9956-ffa450edef68