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

    https://github.com/apache/spark/pull/9769#discussion_r46011950
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -700,25 +700,28 @@ setMethod("collect",
                     # data of complex type can be held. But getting a cell 
from a column
                     # of list type returns a list instead of a vector. So for 
columns of
                     # non-complex type, append them as vector.
    +                #
    +                # For columns of complex type, be careful to access them.
    +                # Get a column of complex type returns a list.
    +                # Get a cell from a column of complex type returns a list 
instead of a vector.
                     col <- listCols[[colIndex]]
    +                colName <- dtypes[[colIndex]][[1]]
                     if (length(col) <= 0) {
    -                  df[[names[colIndex]]] <- col
    +                  df[[colName]] <- col
                     } else {
    -                  # TODO: more robust check on column of primitive types
    -                  vec <- do.call(c, col)
    -                  if (class(vec) != "list") {
    -                    df[[names[colIndex]]] <- vec
    +                  colType <- dtypes[[colIndex]][[2]]
    +                  if (!is.null(PRIMITIVE_TYPES[[colType]]) && colType != 
"binary") {
    +                    vec <- do.call(c, col)
    +                    stopifnot (class(vec) != "list")
    --- End diff --
    
    nit: no space for func call: `stopifnot(class(vec) != "list")`


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