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

    https://github.com/apache/spark/pull/8984#discussion_r41896288
  
    --- Diff: R/pkg/R/DataFrame.R ---
    @@ -1880,4 +1880,46 @@ setMethod("as.data.frame",
                   stop(paste("Unused argument(s): ", paste(list(...), 
collapse=", ")))
                 }
                 collect(x)
    +          }
    +)
    +
    +#' Returns the column types of a DataFrame.
    +#' 
    +#' @name coltypes
    +#' @title Get column types of a DataFrame
    +#' @param x (DataFrame)
    +#' @return value (character) A character vector with the column types of 
the given DataFrame
    +#' @rdname coltypes
    +setMethod("coltypes",
    +          signature(x = "DataFrame"),
    +          function(x) {
    +            # TODO: This may be moved as a global parameter
    +            # These are the supported data types and how they map to
    +            # R's data types
    +            DATA_TYPES <- c("string"="character",
    +                            "long"="integer",
    +                            "tinyint"="integer",
    +                            "short"="integer",
    +                            "integer"="integer",
    +                            "byte"="integer",
    +                            "double"="numeric",
    +                            "float"="numeric",
    +                            "decimal"="numeric",
    +                            "boolean"="logical"
    +            )
    --- End diff --
    
    @olarayej I think the fall back mechanism here is good. But @sun-rui makes 
another good point that it will be good to have one unified place where we do a 
mapping from R types to java types. Right now part of that is in serialize.R / 
deserialize.R
    
    Could you see if there is some refactoring we could do for this to not be 
duplicated ?


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