-
Notifications
You must be signed in to change notification settings - Fork 819
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
Use FixedSizeListArray::new in FixedSizeListBuilder #5612
Conversation
len, | ||
n.len(), | ||
))); | ||
let len = match s { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
let array_data = unsafe { array_data.build_unchecked() }; | ||
|
||
FixedSizeListArray::from(array_data) | ||
FixedSizeListArray::new(field, self.list_len, values, nulls) |
There was a problem hiding this comment.
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 👍
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?