alamb commented on code in PR #23277:
URL: https://github.com/apache/datafusion/pull/23277#discussion_r3520041960
##########
datafusion/datasource/src/statistics.rs:
##########
@@ -97,8 +97,13 @@ impl MinMaxStatistics {
.zip(s.column_statistics[i].max_value.get_value().cloned())
.ok_or_else(|| plan_datafusion_err!("statistics
not found"))
} else {
- let partition_value = &pv[i -
s.column_statistics.len()];
- Ok((partition_value.clone(), partition_value.clone()))
+ if let Some(partition_value) =
+ pv.get(i - s.column_statistics.len())
+ {
+ Ok((partition_value.clone(),
partition_value.clone()))
+ } else {
+ Err(plan_datafusion_err!("statistics not found"))
Review Comment:
should this be an internal error (rather than a planning error)?
Also it might be nice to print out the requested statistics value
(partition_value( and the toal number of columns in the error message to help
debug issues
```rust
Err(plan_datafusion_err!("statistics not found
for partition {partition_value}, expected at most {}",
s.column_statistics.len() - 1))
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]