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

    https://github.com/apache/spark/pull/4498#discussion_r24434802
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala ---
    @@ -264,8 +262,80 @@ class SQLContext(@transient val sparkContext: 
SparkContext)
       }
     
       @DeveloperApi
    -  def applySchema(rowRDD: JavaRDD[Row], schema: StructType): DataFrame = {
    -    applySchema(rowRDD.rdd, schema);
    +  def createDataFrame(rowRDD: JavaRDD[Row], schema: StructType): DataFrame 
= {
    +    createDataFrame(rowRDD.rdd, schema)
    +  }
    +
    +  /**
    +   * Creates a [[DataFrame]] from an [[RDD]] containing [[Row]]s by 
applying
    +   * a seq of names of columns to this RDD, the data type for each column 
will
    +   * be inferred by the first row.
    +   *
    +   * @param rowRDD an RDD of Row
    +   * @param columns names for each column
    +   * @return DataFrame
    +   */
    +  def createDataFrame(rowRDD: RDD[Row], columns: Seq[String]): DataFrame = 
{
    --- End diff --
    
    @yhuai `ScalaReflection.typeOfObject` would help a lot, but others in 
JsonRDD can not fit here well.
    
    I think this API will be useful when user has an RDD of Tuple/Seq, it can 
be easily to be converted into RDD of Row, but don't want to figure out the sql 
types manually.
    
    I hadn't figure out the right scope of this API now, for example, it cannot 
support nested StructType, should it support MapType and ArrayType? Maybe the 
basic version is useful enough, the advanced version (use StructType) will help 
all other rare cases.


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