Skip to content

Conversation

@GrandChaman
Copy link
Contributor

Which issue does this PR close?

Closes #4080.

Rationale for this change

I've noticed that some calls to ScalarValue::iter_to_array could 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_array is called with an empty iterator. I made sure to use arrow::array::new_empty_array in 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.

The size of the iterator that was passed to the the `iter_to_array`
wasn't always checked. Which could cause an error, because the function
couldn't figure out the `DataType` of the array its supposed to
generate.
@github-actions github-actions bot added the core Core DataFusion crate label Nov 14, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

This change makes sense to me -- thank you @GrandChaman

I reviewed https://github.com/apache/arrow-datafusion/blob/28ca3eeac437994be836d299748d3fb3e0ed8b04/datafusion/core/src/physical_plan/aggregates/hash.rs#L425-L450 and I don't think it is affected so we don't need to make changes there

@alamb alamb changed the title Empty iterators used for ScalarValue::iter_to_array Avoid error with empty iterators used for ScalarValue::iter_to_array Nov 15, 2022
@alamb alamb merged commit 88c1201 into apache:master Nov 16, 2022
@alamb
Copy link
Contributor

alamb commented Nov 16, 2022

Thanks again @GrandChaman

@ursabot
Copy link

ursabot commented Nov 16, 2022

Benchmark runs are scheduled for baseline = 13127ae and contender = 88c1201. 88c1201 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

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

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic when using array_agg

3 participants