MCPcopy Create free account
hub / github.com/apache/datafusion / get_exact_column_statistics

Method get_exact_column_statistics

datafusion/common/src/pruning.rs:331–361  ·  view source on GitHub ↗
(
        &self,
        column: &Column,
        get_stat: impl Fn(&ColumnStatistics) -> &Precision<ScalarValue>,
    )

Source from the content-addressed store, hash-verified

329 }
330
331 fn get_exact_column_statistics(
332 &self,
333 column: &Column,
334 get_stat: impl Fn(&ColumnStatistics) -> &Precision<ScalarValue>,
335 ) -> Option<ArrayRef> {
336 let index = self.schema.index_of(column.name()).ok()?;
337 let mut has_value = false;
338 match ScalarValue::iter_to_array(self.statistics.iter().map(|s| {
339 s.column_statistics
340 .get(index)
341 .and_then(|stat| {
342 if let Precision::Exact(min) = get_stat(stat) {
343 has_value = true;
344 Some(min.clone())
345 } else {
346 None
347 }
348 })
349 .unwrap_or(ScalarValue::Null)
350 })) {
351 // If there is any non-null value and no errors, return the array
352 Ok(array) => has_value.then_some(array),
353 Err(_) => {
354 log::warn!(
355 "Failed to convert min values to array for column {}",
356 column.name()
357 );
358 None
359 }
360 }
361 }
362}
363
364impl PruningStatistics for PrunableStatistics {

Callers 2

min_valuesMethod · 0.80
max_valuesMethod · 0.80

Calls 5

nameMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
getMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected