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

Use FixedSizeListArray::new in FixedSizeListBuilder #5612

Merged
merged 3 commits into from
Apr 9, 2024

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Apr 9, 2024

Which issue does this PR close?

Closes #5614

Rationale for this change

Follow up to #5541 that avoids some code duplication

What changes are included in this PR?

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Apr 9, 2024
len,
n.len(),
)));
let len = match s {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the fix for #5614

@@ -662,7 +662,7 @@ mod tests {
);

let list = FixedSizeListArray::new(field.clone(), 0, values.clone(), None);
assert_eq!(list.len(), 6);
assert_eq!(list.len(), 0);
Copy link
Contributor Author

@tustvold tustvold Apr 9, 2024

Choose a reason for hiding this comment

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

This is technically incorrect, in a FixedSizeListArray with size 0, the length of the values has no bearing on the length of the array

I've created #5615 to track that it isn't possible to create a non-empty, non-nullable FixedSizeListArray with size 0.

@tustvold tustvold merged commit 755616f into apache:master Apr 9, 2024
25 checks passed
let array_data = unsafe { array_data.build_unchecked() };

FixedSizeListArray::from(array_data)
FixedSizeListArray::new(field, self.list_len, values, nulls)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is great to use consolidate the validation logic 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FixedSizeListArray::try_new Errors on Entirely Null Array With Size 0
3 participants