[SPARK-20728][SQL][FOLLOWUP] Use an actionable exception message

## What changes were proposed in this pull request?

This is a follow-up of https://github.com/apache/spark/pull/19871 to improve an exception message.

## How was this patch tested?

Pass the Jenkins.

Author: Dongjoon Hyun <dongjoon@apache.org>

Closes #19903 from dongjoon-hyun/orc_exception.
This commit is contained in:
Dongjoon Hyun 2017-12-06 20:20:20 +09:00 committed by hyukjinkwon
parent 00d176d2fe
commit fb6a922751
2 changed files with 6 additions and 6 deletions

View file

@ -598,11 +598,11 @@ object DataSource extends Logging {
// Found the data source using fully qualified path
dataSource
case Failure(error) =>
if (provider1.toLowerCase(Locale.ROOT) == "orc" ||
provider1.startsWith("org.apache.spark.sql.hive.orc")) {
if (provider1.startsWith("org.apache.spark.sql.hive.orc")) {
throw new AnalysisException(
"Hive-based ORC data source must be used with Hive support enabled. " +
"Please use native ORC data source instead")
"Hive built-in ORC data source must be used with Hive support enabled. " +
"Please use the native ORC data source by setting 'spark.sql.orc.impl' to " +
"'native'")
} else if (provider1.toLowerCase(Locale.ROOT) == "avro" ||
provider1 == "com.databricks.spark.avro") {
throw new AnalysisException(

View file

@ -1666,7 +1666,7 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
e = intercept[AnalysisException] {
sql(s"select id from `org.apache.spark.sql.hive.orc`.`file_path`")
}
assert(e.message.contains("Hive-based ORC data source must be used with Hive support"))
assert(e.message.contains("Hive built-in ORC data source must be used with Hive support"))
e = intercept[AnalysisException] {
sql(s"select id from `com.databricks.spark.avro`.`file_path`")
@ -2790,7 +2790,7 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
val e = intercept[AnalysisException] {
sql("CREATE TABLE spark_20728(a INT) USING ORC")
}
assert(e.message.contains("Hive-based ORC data source must be used with Hive support"))
assert(e.message.contains("Hive built-in ORC data source must be used with Hive support"))
}
withSQLConf(SQLConf.ORC_IMPLEMENTATION.key -> "native") {