-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16883][SparkR]:SQL decimal type is not properly cast to number when collecting SparkDataFrame #14613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-16883][SparkR]:SQL decimal type is not properly cast to number when collecting SparkDataFrame #14613
Changes from all commits
7f55569
4f88f47
6d19711
63b9d06
4d6d048
4e9e403
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -397,7 +397,11 @@ setMethod("coltypes", | |
| } | ||
|
|
||
| if (is.null(type)) { | ||
| stop(paste("Unsupported data type: ", x)) | ||
| specialtype <- specialtypeshandle(x) | ||
| if (is.null(specialtype)) { | ||
| stop(paste("Unsupported data type: ", x)) | ||
| } | ||
| type <- PRIMITIVE_TYPES[[specialtype]] | ||
| } | ||
| } | ||
| type | ||
|
|
@@ -1063,6 +1067,13 @@ setMethod("collect", | |
| df[[colIndex]] <- col | ||
| } else { | ||
| colType <- dtypes[[colIndex]][[2]] | ||
| if (is.null(PRIMITIVE_TYPES[[colType]])) { | ||
| specialtype <- specialtypeshandle(colType) | ||
| if (!is.null(specialtype)) { | ||
| colType <- specialtype | ||
|
||
| } | ||
| } | ||
|
|
||
| # Note that "binary" columns behave like complex types. | ||
| if (!is.null(PRIMITIVE_TYPES[[colType]]) && colType != "binary") { | ||
| vec <- do.call(c, col) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it looks like we are expecting
typeto be R native type, but seems likespecialtypeshandleis returningdoublewhich is not a R native type? (per se - for historical reasons)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or rather,
numericis better since it matches the mapping inPRIMITIVE_TYPES?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numericis not the key of PRIMITIVE_TYPE map.is.null(PRIMITIVE_TYPES[[colType]])is NULL if mapped tonumerictype.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as line 383
type <- PRIMITIVE_TYPES[[x]]here in line 399
specialtype <- specialtypeshandle(x)type <- specialtypenumeric is one of the value from PRIMITIVE_TYPE, double, returned by
specialtypeshandle, is notThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and then from my comment below, line 1059
colType <- dtypes[[colIndex]][[2]]colType is from dtypes which is the JVM type.
specialtype <- specialtypeshandle(colType)so seem like we are mixing in both cases.