HIVE-9041: Generate better plan for queries containing both union and multi-insert [Spark Branch] (Chao via Xuefu)

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