Skip to content

Conversation

@mgaido91
Copy link
Contributor

@mgaido91 mgaido91 commented Apr 4, 2018

What changes were proposed in this pull request?

There was no check on nullability for arguments of Tuples. This could lead to have weird behavior when a null value had to be deserialized into a non-nullable Scala object: in those cases, the null got silently transformed in a valid value (like -1 for Int), corresponding to the default value we are using in the SQL codebase. This situation was very likely to happen when deserializing to a Tuple of primitive Scala types (like Double, Int, ...).

The PR adds the AssertNotNull to arguments of tuples which have been asked to be converted to non-nullable types.

How was this patch tested?

added UT

@SparkQA
Copy link

SparkQA commented Apr 4, 2018

Test build #88892 has finished for PR 20976 at commit b3e70e9.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mgaido91
Copy link
Contributor Author

mgaido91 commented Apr 4, 2018

retest this please

@SparkQA
Copy link

SparkQA commented Apr 4, 2018

Test build #88903 has finished for PR 20976 at commit b3e70e9.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 5, 2018

Test build #88940 has finished for PR 20976 at commit b78ff6c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mgaido91
Copy link
Contributor Author

mgaido91 commented Apr 5, 2018

retest this please

@mgaido91
Copy link
Contributor Author

mgaido91 commented Apr 5, 2018

UT errors were caused by another commit which has been reverted.

@SparkQA
Copy link

SparkQA commented Apr 5, 2018

Test build #88949 has finished for PR 20976 at commit b78ff6c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 6, 2018

Test build #88975 has finished for PR 20976 at commit 03c9313.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mgaido91
Copy link
Contributor Author

mgaido91 commented Apr 6, 2018

@mgaido91
Copy link
Contributor Author

kindly ping @cloud-fan @marmbrus @viirya

@cloud-fan
Copy link
Contributor

LGTM, can you add an end-to-end test case in DatasetSuite?

@SparkQA
Copy link

SparkQA commented Apr 17, 2018

Test build #89444 has finished for PR 20976 at commit 92cd4fe.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

asfgit pushed a commit that referenced this pull request Apr 17, 2018
…ation

## What changes were proposed in this pull request?

There was no check on nullability for arguments of `Tuple`s. This could lead to have weird behavior when a null value had to be deserialized into a non-nullable Scala object: in those cases, the `null` got silently transformed in a valid value (like `-1` for `Int`), corresponding to the default value we are using in the SQL codebase. This situation was very likely to happen when deserializing to a Tuple of primitive Scala types (like Double, Int, ...).

The PR adds the `AssertNotNull` to arguments of tuples which have been asked to be converted to non-nullable types.

## How was this patch tested?

added UT

Author: Marco Gaido <[email protected]>

Closes #20976 from mgaido91/SPARK-23835.

(cherry picked from commit 0a9172a)
Signed-off-by: Wenchen Fan <[email protected]>
@cloud-fan
Copy link
Contributor

thanks, merging to master/2.3!

@asfgit asfgit closed this in 0a9172a Apr 17, 2018
@viirya
Copy link
Member

viirya commented Apr 17, 2018

ah, a late LGTM.

otterc pushed a commit to linkedin/spark that referenced this pull request Mar 22, 2023
…ation

There was no check on nullability for arguments of `Tuple`s. This could lead to have weird behavior when a null value had to be deserialized into a non-nullable Scala object: in those cases, the `null` got silently transformed in a valid value (like `-1` for `Int`), corresponding to the default value we are using in the SQL codebase. This situation was very likely to happen when deserializing to a Tuple of primitive Scala types (like Double, Int, ...).

The PR adds the `AssertNotNull` to arguments of tuples which have been asked to be converted to non-nullable types.

added UT

Author: Marco Gaido <[email protected]>

Closes apache#20976 from mgaido91/SPARK-23835.

Ref: LIHADOOP-48531

RB=1850759
G=superfriends-reviewers
R=mshen,zolin,latang,fli,yezhou
A=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants