Skip to content

Correctly reading empty fields in as null rather than throwing exception #1816

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

Merged
merged 2 commits into from
Dec 13, 2021

Conversation

masseyke
Copy link
Member

@masseyke masseyke commented Dec 9, 2021

By default we intend to treat empty fields as nulls when being read in through spark sql. However we actually
turn them into None objects, which causes spark-sql to blow up. This commit treats them as nulls.
Closes #1635

@masseyke
Copy link
Member Author

masseyke commented Dec 9, 2021

I added an integration test for all 3 versions of spark that we support. It turns out that this worked fine in spark 1.x but broke in 2.x.

@masseyke masseyke requested a review from jbaiera December 13, 2021 14:45
Copy link
Member

@jbaiera jbaiera left a comment

Choose a reason for hiding this comment

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

LGTM!

@jbaiera
Copy link
Member

jbaiera commented Dec 13, 2021

Thanks for putting those tests in

@masseyke masseyke merged commit 52c264f into elastic:master Dec 13, 2021
@masseyke masseyke deleted the fix/empty-fields-throw-exception branch December 13, 2021 19:40
masseyke added a commit to masseyke/elasticsearch-hadoop that referenced this pull request Dec 20, 2021
…ion (elastic#1816)

By default we intend to treat empty fields as nulls when being read in through spark sql. However we actually
turn them into None objects, which causes spark-sql to blow up in spark 2 and 3. This commit treats them
as nulls, which works for all versions of spark we currently support.
Closes elastic#1635
masseyke added a commit to masseyke/elasticsearch-hadoop that referenced this pull request Dec 20, 2021
…ion (elastic#1816)

By default we intend to treat empty fields as nulls when being read in through spark sql. However we actually
turn them into None objects, which causes spark-sql to blow up in spark 2 and 3. This commit treats them
as nulls, which works for all versions of spark we currently support.
Closes elastic#1635
masseyke added a commit that referenced this pull request Dec 20, 2021
…ion (#1816) (#1831)

By default we intend to treat empty fields as nulls when being read in through spark sql. However we actually
turn them into None objects, which causes spark-sql to blow up in spark 2 and 3. This commit treats them
as nulls, which works for all versions of spark we currently support.
Closes #1635
masseyke added a commit that referenced this pull request Dec 20, 2021
…ion (#1816) (#1832)

By default we intend to treat empty fields as nulls when being read in through spark sql. However we actually
turn them into None objects, which causes spark-sql to blow up in spark 2 and 3. This commit treats them
as nulls, which works for all versions of spark we currently support.
Closes #1635
@masseyke masseyke added :Spark and removed :Core labels Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spark 3.0 scala.None$ is not a valid external type for schema of string error on read
3 participants