Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7802#discussion_r36109477
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ddl.scala ---
    @@ -190,21 +194,19 @@ private[sql] class DDLParser(
         }
     }
     
    -private[sql] object ResolvedDataSource {
    -
    -  private val builtinSources = Map(
    -    "jdbc" -> "org.apache.spark.sql.jdbc.DefaultSource",
    -    "json" -> "org.apache.spark.sql.json.DefaultSource",
    -    "parquet" -> "org.apache.spark.sql.parquet.DefaultSource",
    -    "orc" -> "org.apache.spark.sql.hive.orc.DefaultSource"
    -  )
    +private[sql] object ResolvedDataSource extends Logging {
     
       /** Given a provider name, look up the data source class definition. */
       def lookupDataSource(provider: String): Class[_] = {
         val loader = Utils.getContextOrSparkClassLoader
    -
    -    if (builtinSources.contains(provider)) {
    -      return loader.loadClass(builtinSources(provider))
    +    val sl = ServiceLoader.load(classOf[DataSourceProvider], loader)
    --- End diff --
    
    Hmmm... I wonder how expensive this is on subsequent calls. Would it be 
better to put this in a lazy val at the object level? That may make it tricky 
to handle different class loaders, though.


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