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

    https://github.com/apache/spark/pull/9099#discussion_r44858549
  
    --- Diff: R/pkg/R/SQLContext.R ---
    @@ -90,19 +96,31 @@ createDataFrame <- function(sqlContext, data, schema = 
NULL, samplingRatio = 1.0
           if (is.null(schema)) {
             schema <- names(data)
           }
    -      n <- nrow(data)
    -      m <- ncol(data)
    -      # get rid of factor type
    -      dropFactor <- function(x) {
    +
    +      # types that should be wrapped before
    +      # mapply to avoid flattening
    +      requires_wrapping <- c("list")
    +
    +      # get rid of factor type and adjust for lists
    +      cleanCols <- function(x) {
             if (is.factor(x)) {
               as.character(x)
    +        } else if(class(x) %in% requires_wrapping) {
    --- End diff --
    
    The bug of SPARK-11283 lies in
    ```
    lapply(1:m, function(j) { dropFactor(data[i,j]) })
    ```
    in which data[i,j] returns a list of item instead item itself  when the 
item is in a column of list type.
    
    Use mapply fixs it!


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