fix(arrow-pg): emit NULL field for null struct values instead of skipping encoding#299
Merged
sunng87 merged 1 commit intodatafusion-contrib:masterfrom Feb 26, 2026
Conversation
Member
|
Good catch! Thank you @vimeh Could you run |
…ping encoding `encode_struct` returned `Ok(())` for null struct values without calling `encoder.encode_field()`. This skipped writing a NULL indicator to the pgwire DataRow, corrupting the column count and breaking client connections. The fix calls `encoder.encode_field(&None::<&[i8]>, ...)` for null structs, consistent with how List and Dictionary types already handle nulls in `encode_value`. Adds a regression test that verifies `encode_field` is called exactly once when encoding a null struct row.
498970b to
c794e99
Compare
Contributor
Author
|
done! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
encode_structreturnsOk(())for null struct values without callingencoder.encode_field(). This skips writing a NULL indicator to the pgwire DataRow, corrupting the column count and breaking client connections.Every other nullable type in
encode_value(Lists at line 486, Dictionaries at line 494) correctly callsencoder.encode_field(&None::<T>, pg_field)for null values. Structs are the only type that silently skips the field.