Skip to content

[SPARK-50906][SQL][SS] Add nullability check for if inputs of to_avro align with schema#49590

Closed
fanyue-xia wants to merge 9 commits intoapache:masterfrom
fanyue-xia:to_avro_improve_NPE
Closed

[SPARK-50906][SQL][SS] Add nullability check for if inputs of to_avro align with schema#49590
fanyue-xia wants to merge 9 commits intoapache:masterfrom
fanyue-xia:to_avro_improve_NPE

Conversation

@fanyue-xia
Copy link
Contributor

What changes were proposed in this pull request?

Previously, we don't explicitly check when input of to_avro is null but the schema does not allow null. As a result, a NPE will be raised in this situation. This PR adds the check during serialization before writing to avro and raises user-facing error if above occurs.

Why are the changes needed?

It makes it easier for the user to understand and face the error.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit test

Was this patch authored or co-authored using generative AI tooling?

No

@fanyue-xia fanyue-xia force-pushed the to_avro_improve_NPE branch 5 times, most recently from 01e48be to d5ad9b1 Compare January 23, 2025 20:34
Copy link
Member

@gengliangwang gengliangwang left a comment

Choose a reason for hiding this comment

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

LGTM except one comment

@gengliangwang gengliangwang changed the title [SPARK-50906][SS] Add nullability check for if inputs of to_avro align with schema [SPARK-50906][SQL][SS] Add nullability check for if inputs of to_avro align with schema Jan 29, 2025
@gengliangwang
Copy link
Member

Thanks, merging to master!

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.

3 participants