-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15657][SQL] RowEncoder should validate the data type of input object #13401
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
Conversation
|
Test build #59629 has finished for PR 13401 at commit
|
|
|
||
| val code = s""" | ||
| ${input.code} | ||
| ${ctx.javaType(dataType)} ${ev.value} = ${ctx.defaultValue(dataType)}; |
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.
ctx.boxedType here too?
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.
This is intentional, we can't cast an object to int directly, but have to cast to boxed int first.
|
Test build #59944 has finished for PR 13401 at commit
|
|
Test build #59968 has finished for PR 13401 at commit
|
|
LGTM, merging to master and branch-2.0. |
…object ## What changes were proposed in this pull request? This PR improves the error handling of `RowEncoder`. When we create a `RowEncoder` with a given schema, we should validate the data type of input object. e.g. we should throw an exception when a field is boolean but is declared as a string column. This PR also removes the support to use `Product` as a valid external type of struct type. This support is added at #9712, but is incomplete, e.g. nested product, product in array are both not working. However, we never officially support this feature and I think it's ok to ban it. ## How was this patch tested? new tests in `RowEncoderSuite`. Author: Wenchen Fan <wenchen@databricks.com> Closes #13401 from cloud-fan/bug. (cherry picked from commit 30c4774) Signed-off-by: Cheng Lian <lian@databricks.com>
What changes were proposed in this pull request?
This PR improves the error handling of
RowEncoder. When we create aRowEncoderwith a given schema, we should validate the data type of input object. e.g. we should throw an exception when a field is boolean but is declared as a string column.This PR also removes the support to use
Productas a valid external type of struct type. This support is added at #9712, but is incomplete, e.g. nested product, product in array are both not working. However, we never officially support this feature and I think it's ok to ban it.How was this patch tested?
new tests in
RowEncoderSuite.