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

    https://github.com/apache/spark/pull/1346#discussion_r14904635
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala ---
    @@ -89,6 +88,33 @@ class SQLContext(@transient val sparkContext: 
SparkContext)
         new SchemaRDD(this, SparkLogicalPlan(ExistingRdd.fromProductRdd(rdd)))
     
       /**
    +   * Creates a [[SchemaRDD]] from an [[RDD]] by applying a schema to this 
RDD and using a function
    +   * that will be applied to each partition of the RDD to convert RDD 
records to [[Row]]s.
    +   *
    +   * @group userf
    +   */
    +  def applySchema[A](rdd: RDD[A], schema: StructType, f: A => Row): 
SchemaRDD =
    +    applySchemaToPartitions(rdd, schema, (iter: Iterator[A]) => 
iter.map(f))
    +
    +  /**
    +   * Creates a [[SchemaRDD]] from an [[RDD]] by applying a schema to this 
RDD and using a function
    +   * that will be applied to each partition of the RDD to convert RDD 
records to [[Row]]s.
    --- End diff --
    
    Maybe provide some guidance here on when you'd want to use this function.
    
    > Similar to `RDD.mapPartitions`, this function can be used to improve 
performance where there is other setup work that can be amortized and used 
repeatedly for all of the elements in a partition.


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

Reply via email to