Skip to content

Conversation

@klion26
Copy link
Member

@klion26 klion26 commented Nov 12, 2025

Which issue does this PR close?

What changes are included in this PR?

Fix the logic for VariantToNullArrowRowBuilder so that it respects the cast option

Are these changes tested?

added test

Are there any user-facing changes?

Noe

@github-actions github-actions bot added the parquet-variant parquet-variant* crates label Nov 12, 2025
Copy link
Member Author

@klion26 klion26 left a comment

Choose a reason for hiding this comment

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

@scovich @liamzwbao Please help review this when you're free ,thanks.

if let Some(_) = value.as_null() {
Ok(true)
} else {
// Null type only accepts nulls
Copy link
Member Author

Choose a reason for hiding this comment

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

Choose to return err because Arrays of type Null cannot contain a null bitmask. If we return NullArray::new(valid_value_count), then the length of the result may not be the same as the input(the other types will add None in the result)

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree we can't add a NULL mask to a NullArray. But I thought the idea was to let the normal strict-mode checking either error out or call (our fake) append_null that actually does the same thing as append_value (namely nothing). No null masks in sight.

Copy link
Contributor

Choose a reason for hiding this comment

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

The comment in the issue about counting appended values/nulls was kind of unrelated: technically there's no guarantee the number of appends matches the initial capacity estimate, which in arrow API is only an estimate. So we should ideally have both append_null and append_value increment some counter, whose final value dictates the size of the final array we create.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variant to NullType conversion ignores strict casting

2 participants