Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Return null for primitive types when value matches nullValue string#542

Merged
srowen merged 2 commits intodatabricks:masterfrom
srowen:Issue540
Jun 10, 2021
Merged

Return null for primitive types when value matches nullValue string#542
srowen merged 2 commits intodatabricks:masterfrom
srowen:Issue540

Conversation

@srowen
Copy link
Copy Markdown
Collaborator

@srowen srowen commented Jun 9, 2021

Closes #540

While the code did handle detection of input matching the nullValue and returning null, in paths where the column type was a primitive in Java like DoubleType, the cast turned it into 0.0. This adds additional checking to perform the same check earlier.

@srowen srowen added the bug label Jun 9, 2021
@srowen srowen added this to the 0.13.0 milestone Jun 9, 2021
@srowen srowen self-assigned this Jun 9, 2021
nullable ||
(options.treatEmptyValuesAsNulls && datum == "")){
options: XmlOptions): Any = {
if ((datum == options.nullValue) ||
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullable was not used - always true. The code path here doesn't actually care about nullability of the column, which is ... OK ? if it returns null where it's not allowed, because the input said it was null, that's an error later anyway and probably correctly.

@srowen srowen merged commit 57baf02 into databricks:master Jun 10, 2021
@srowen srowen deleted the Issue540 branch June 10, 2021 14:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NULL values not working for numeric fields

1 participant