[SPARK-2797] [SQL] https://issues.apache.org/jira/browse/SPARK-2797

The cause is explained in https://issues.apache.org/jira/browse/SPARK-2797.