Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/5158#discussion_r27062720
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/sources/ddl.scala ---
@@ -204,19 +204,25 @@ private[sql] object ResolvedDataSource {
provider: String,
options: Map[String, String]): ResolvedDataSource = {
val clazz: Class[_] = lookupDataSource(provider)
+ def className = clazz.getCanonicalName
val relation = userSpecifiedSchema match {
case Some(schema: StructType) => clazz.newInstance() match {
case dataSource: SchemaRelationProvider =>
dataSource.createRelation(sqlContext, new
CaseInsensitiveMap(options), schema)
case dataSource: org.apache.spark.sql.sources.RelationProvider =>
- sys.error(s"${clazz.getCanonicalName} does not allow
user-specified schemas.")
+ throw new AnalysisException(s"$className does not allow
user-specified schemas.")
+ case _ =>
+ throw new AnalysisException(s"$className is not a
RelationProvider.")
}
case None => clazz.newInstance() match {
case dataSource: RelationProvider =>
dataSource.createRelation(sqlContext, new
CaseInsensitiveMap(options))
case dataSource:
org.apache.spark.sql.sources.SchemaRelationProvider =>
- sys.error(s"A schema needs to be specified when using
${clazz.getCanonicalName}.")
+ throw new AnalysisException(
+ s"A schema needs to be specified when using
${clazz.getCanonicalName}.")
--- End diff --
minor: `${clazz.getCanonicalName}` => `$className`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]