Github user sun-rui commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12836#discussion_r66721354
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/RelationalGroupedDataset.scala ---
    @@ -381,6 +385,50 @@ class RelationalGroupedDataset protected[sql](
       def pivot(pivotColumn: String, values: java.util.List[Any]): 
RelationalGroupedDataset = {
         pivot(pivotColumn, values.asScala)
       }
    +
    +  /**
    +   * Applies the given serialized R function `func` to each group of data. 
For each unique group,
    +   * the function will be passed the group key and an iterator that 
contains all of the elements in
    +   * the group. The function can return an iterator containing elements of 
an arbitrary type which
    +   * will be returned as a new [[DataFrame]].
    +   *
    +   * This function does not support partial aggregation, and as a result 
requires shuffling all
    +   * the data in the [[Dataset]]. If an application intends to perform an 
aggregation over each
    +   * key, it is best to use the reduce function or an
    +   * [[org.apache.spark.sql.expressions#Aggregator Aggregator]].
    +   *
    +   * Internally, the implementation will spill to disk if any given group 
is too large to fit into
    +   * memory.  However, users must take care to avoid materializing the 
whole iterator for a group
    +   * (for example, by calling `toList`) unless they are sure that this is 
possible given the memory
    +   * constraints of their cluster.
    +   *
    +   * @since 2.0.0
    +   */
    +  private[sql] def flatMapGroupsInR(
    +      f: Array[Byte],
    +      packageNames: Array[Byte],
    +      broadcastVars: Array[Object],
    +      outputSchema: StructType): DataFrame = {
    +      val broadcastVarObj = 
broadcastVars.map(_.asInstanceOf[Broadcast[Object]])
    +      val groupingNamedExpressions = groupingExprs.map(alias)
    +      val groupingCols = groupingNamedExpressions.map(Column(_))
    +      val groupingDataFrame = df.select(groupingCols : _*)
    +      val groupingAttributes = groupingNamedExpressions.map(_.toAttribute)
    +      val realOutputSchema = if (outputSchema == null) 
SERIALIZED_R_DATA_SCHEMA else outputSchema
    --- End diff --
    
    yeah, I think we  need gapplyCollect() 


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

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

Reply via email to