You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by mengxr <gi...@git.apache.org> on 2015/09/21 01:01:11 UTC

[GitHub] spark pull request: [SPARK-10630][SQL] Add a createDataFrame API t...

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

    https://github.com/apache/spark/pull/8779#discussion_r39936067
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala ---
    @@ -477,6 +477,20 @@ class SQLContext(@transient val sparkContext: SparkContext)
       }
     
       /**
    +   * :: DeveloperApi ::
    +   * Creates a [[DataFrame]] from an [[java.util.List]] containing [[Row]]s using the given schema.
    +   * It is important to make sure that the structure of every [[Row]] of the provided List matches
    +   * the provided schema. Otherwise, there will be runtime exception.
    +   *
    +   * @group dataframes
    +   * @since 1.6.0
    +   */
    +  @DeveloperApi
    +  def createDataFrame(rows: java.util.List[Row], schema: StructType): DataFrame = {
    +    createDataFrame(sparkContext.parallelize(rows.asScala), schema)
    --- End diff --
    
    Should create a local DataFrame using `LocalRelation`. See https://github.com/holdenk/spark/blob/SPARK-10630-create-DataFrame-from-Java-List/sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala#L385.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org