fix nullpointer cause by auto join conversion

Summary:
HIVE-4927
HIVE 4521 Auto join conversion fails in certain cases (empty tables, empty partitions, no partitions)
HIVE-4540 JOIN-GRP BY-DISTINCT fails with NPE when mapjoin.mapreduce=true

Merge branch 'nullpointer' into nullpointer_fix

Test Plan: none

Reviewers: chenchun

CC: xieyuchen

Differential Revision: http://192.168.2.241/D413
 fix zk log bug
HIVE-4761 : ZooKeeperHiveLockManage.unlockPrimitive has race condition with threads (Brock Noland via Ashutosh Chauhan)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1495055 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit d372457395aad3218d6d2136a3a1c02372bac742)
HIVE-4733 : HiveLockObjectData is not compared properly (Navis via Ashutosh Chauhan)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1500569 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 4a19edb5fd69bf6438e682a15d9a6ceacbc2b929)
HIVE-5575: ZooKeeper connection closed when unlock with retry (Chun Chen via Brock Noland)

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1533511 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 3034883d6da320d4b237c068d5a0e16176818b59)
Merge branch 'zookeeper' into mthive-0.11-dev
distinct
distinct
HIVE-4932 PTFOperator fails resetting PTFPersistence (Navis Ryu via egc)

Submitted by:	Navis Ryu
Reviewed by:	Edward Capriolo

git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1507186 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 72f8b2b7ba1f9c9bc04ec66e620d3b256a3bc2e2)
Merge branch 'mthive-0.11-dev' of github.com:MTDATA/hive into mthive-0.11-dev
HIVE-5655