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

The PR for master branch can't be backported to branch 1.1 directly because Hive 0.13.1 support.