Avoid error with empty iterators used for ScalarValue::iter_to_array
#4206
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.
Which issue does this PR close?
Closes #4080.
Rationale for this change
I've noticed that some calls to
ScalarValue::iter_to_arraycould have an empty iterator as argument, which caused an error.What changes are included in this PR?
In 2 places I found out that sometimes,
ScalarValue::iter_to_arrayis called with an empty iterator. I made sure to usearrow::array::new_empty_arrayin this case.Are these changes tested?
One of them is (the one about the
ScalarValue::List).I didn't find a good way to test the other one, as it seems to require some more insights into how the aggregation works internally.
Are there any user-facing changes?
No, and no breaking changes.