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

    https://github.com/apache/spark/pull/4446#discussion_r24306331
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala ---
    @@ -398,27 +398,173 @@ class SQLContext(@transient val sparkContext: 
SparkContext)
         jsonRDD(json.rdd, samplingRatio);
       }
     
    +  /**
    +   * :: Experimental ::
    +   * Loads a dataset from the given path as a DataFrame.
    +   * It will use the default data source configured in 
spark.sql.sources.default.
    +   */
       @Experimental
       def load(path: String): DataFrame = {
         val dataSourceName = conf.defaultDataSourceName
    -    load(dataSourceName, ("path", path))
    +    load(path, dataSourceName)
    +  }
    +
    +  /**
    +   * :: Experimental ::
    +   * Loads a dataset from the given path as a DataFrame based on a given 
data source.
    +   * It will use the default data source configured in 
spark.sql.sources.default.
    +   */
    +  @Experimental
    +  def load(
    +      path: String,
    +      dataSourceName: String): DataFrame = {
    +    load(dataSourceName, Map("path" -> path))
       }
     
    +  /**
    +   * :: Experimental ::
    +   * Loads a dataset based on a given data source and a set of options.
    +   */
       @Experimental
       def load(
           dataSourceName: String,
    -      option: (String, String),
    -      options: (String, String)*): DataFrame = {
    -    val resolved = ResolvedDataSource(this, None, dataSourceName, (option 
+: options).toMap)
    +      options: java.util.Map[String, String]): DataFrame = {
    +    load(dataSourceName, options.toMap)
    +  }
    +
    +  /**
    +   * :: Experimental ::
    +   * Loads a dataset based on a given data source and a set of options.
    +   */
    +  @Experimental
    +  def load(
    +      dataSourceName: String,
    +      options: Map[String, String]): DataFrame = {
    +    val resolved = ResolvedDataSource(this, None, dataSourceName, options)
         DataFrame(this, LogicalRelation(resolved.relation))
       }
     
    +  /**
    +   * :: Experimental ::
    +   * Loads a dataset based on a given data source, a schema and a set of 
options.
    +   */
       @Experimental
       def load(
           dataSourceName: String,
    +      schema: StructType,
           options: java.util.Map[String, String]): DataFrame = {
    -    val opts = options.toSeq
    -    load(dataSourceName, opts.head, opts.tail:_*)
    +    load(dataSourceName, schema, options.toMap)
    +  }
    +
    +  /**
    +   * :: Experimental ::
    +   * Loads a dataset based on a given data source, a schema and a set of 
options.
    --- End diff --
    
    (Scala-specific)


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