Skip to content
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

fix: entries field is non-nullable #4808

Merged
merged 1 commit into from
Sep 10, 2023

Conversation

wjones127
Copy link
Member

Which issue does this PR close?

Closes #4807.

Rationale for this change

The "entries" field shouldn't be nullable:

https://github.com/apache/arrow/blob/c4b01c60fba85bbfc3a1b1510e179153c0f79515/format/Schema.fbs#L124

Elsewhere, we have this as false already:

https://github.com/apache/arrow-rs/blob/master/arrow-schema/src/field.rs#L230

The inconsistency on this causes schema mismatch issues, such as those documented in:

delta-io/delta-rs#1619

What changes are included in this PR?

Changes all functions that construct the "entries" field to be non-nullable.

Are there any user-facing changes?

Yes, this will change the type output by the MapType::new_from_strings() and canonicalize_schema() functions.

@wjones127 wjones127 added arrow Changes to the arrow crate bug api-change Changes to the arrow API labels Sep 10, 2023
@wjones127 wjones127 marked this pull request as ready for review September 10, 2023 00:14
@@ -1487,7 +1487,7 @@ mod tests {
let keys_field = Arc::new(Field::new_dict(
"keys",
DataType::Dictionary(Box::new(DataType::Int8), Box::new(DataType::Utf8)),
true,
true, // It is technically not legal for this field to be null.
Copy link
Member

@viirya viirya Sep 10, 2023

Choose a reason for hiding this comment

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

This cannot be set to false?

Copy link
Member Author

Choose a reason for hiding this comment

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

The test itself has null values in the test case. Perhaps I should modify the test case?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I got what you mean. Okay to keep it as is.

Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

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

Looks correct as this follows the spec.

@tustvold tustvold merged commit 77455d4 into apache:master Sep 10, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API arrow Changes to the arrow crate bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MapArray::new_from_strings creates nullable entries field
3 participants