[SPARK-4308][SQL] Follow up of #3175 for branch 1.1

PR #3175 is for master branch only and can't be backported to branch 1.1 directly because Hive 0.13.1 support.