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

    https://github.com/apache/spark/pull/12836#discussion_r65120565
  
    --- Diff: R/pkg/inst/worker/worker.R ---
    @@ -84,67 +84,78 @@ broadcastElap <- elapsedSecs()
     # as number of partitions to create.
     numPartitions <- SparkR:::readInt(inputCon)
     
    -isDataFrame <- as.logical(SparkR:::readInt(inputCon))
    +# 0 - RDD mode, 1 - dapply mode, 2 - gapply mode
    +mode <- SparkR:::readInt(inputCon)
     
    -# If isDataFrame, then read column names
    -if (isDataFrame) {
    +# If DataFrame - mode = 1 and mode = 2, then read column names
    +if (mode > 0) {
       colNames <- SparkR:::readObject(inputCon)
    +  if (mode == 2) {
    +    key <- SparkR:::readObject(inputCon)
    +  }
     }
     
     isEmpty <- SparkR:::readInt(inputCon)
     
     if (isEmpty != 0) {
    -
       if (numPartitions == -1) {
         if (deserializer == "byte") {
           # Now read as many characters as described in funcLen
    -      data <- SparkR:::readDeserialize(inputCon)
    +      dataList <- list(SparkR:::readDeserialize(inputCon))
         } else if (deserializer == "string") {
    -      data <- as.list(readLines(inputCon))
    -    } else if (deserializer == "row") {
    -      data <- SparkR:::readMultipleObjects(inputCon)
    +      dataList <- list(as.list(readLines(inputCon)))
    +    } else if (deserializer == "row" && mode == 2) {
    +      dataList <- SparkR:::readMultipleObjectsWithKeys(inputCon)
    +    } else if (deserializer == "row"){
    +      dataList <- list(SparkR:::readMultipleObjects(inputCon))
         }
         # Timing reading input data for execution
         inputElap <- elapsedSecs()
    -
    -    if (isDataFrame) {
    -      if (deserializer == "row") {
    -        # Transform the list of rows into a data.frame
    -        # Note that the optional argument stringsAsFactors for rbind is
    -        # available since R 3.2.4. So we set the global option here.
    -        oldOpt <- getOption("stringsAsFactors")
    -        options(stringsAsFactors = FALSE)
    -        data <- do.call(rbind.data.frame, data)
    -        options(stringsAsFactors = oldOpt)
    -
    -        names(data) <- colNames
    +    for (i in 1:length(dataList)) {
    --- End diff --
    
    done! I called it computeHelper, thought compute might be too generic for 
this specific use case.
    I can still rename it to compute if you think that it's a better name.


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