Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17916#discussion_r115634610
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala
 ---
    @@ -570,10 +570,20 @@ object DataSource {
               // there is exactly one registered alias
               head.getClass
             case sources =>
    -          // There are multiple registered aliases for the input
    -          sys.error(s"Multiple sources found for $provider1 " +
    -            s"(${sources.map(_.getClass.getName).mkString(", ")}), " +
    -            "please specify the fully qualified class name.")
    +          // There are multiple registered aliases for the input. If there 
is single datasource
    +          // that has "org.apache.spark" package in the prefix, we use it 
considering it is an
    +          // internal datasource within Spark.
    +          val sourceNames = sources.map(_.getClass.getName)
    +          val internalSources = 
sources.filter(_.getClass.getName.startsWith("org.apache.spark"))
    +          if (internalSources.size == 1) {
    +            logWarning(s"Multiple sources found for $provider1 
(${sourceNames.mkString(", ")}), " +
    +              "please specify the fully qualified class name. " +
    +              s"Using the internal datasource 
(${internalSources.head.getClass.getName}).")
    +            internalSources.head.getClass
    +          } else {
    +            sys.error(s"Multiple sources found for $provider1 
(${sourceNames.mkString(", ")}), " +
    --- End diff --
    
    nit: let's throw analysis exception


---
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]

Reply via email to