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

Method contained

datafusion/common/src/pruning.rs:274–299  ·  view source on GitHub ↗
(
        &self,
        column: &Column,
        values: &HashSet<ScalarValue>,
    )

Source from the content-addressed store, hash-verified

272 }
273
274 fn contained(
275 &self,
276 column: &Column,
277 values: &HashSet<ScalarValue>,
278 ) -> Option<BooleanArray> {
279 let index = self.partition_schema.index_of(column.name()).ok()?;
280 let array = self.partition_values.get(index)?;
281 let boolean_array = values.iter().try_fold(None, |acc, v| {
282 let arrow_value = v.to_scalar().ok()?;
283 let eq_result = arrow::compute::kernels::cmp::eq(array, &arrow_value).ok()?;
284 match acc {
285 None => Some(Some(eq_result)),
286 Some(acc_array) => {
287 arrow::compute::kernels::boolean::or_kleene(&acc_array, &eq_result)
288 .map(Some)
289 .ok()
290 }
291 }
292 })??;
293 // If the boolean array is empty or all null values, return None
294 if boolean_array.is_empty() || boolean_array.null_count() == boolean_array.len() {
295 None
296 } else {
297 Some(boolean_array)
298 }
299 }
300}
301
302/// Prune a set of containers represented by their statistics.

Calls 9

eqFunction · 0.85
to_scalarMethod · 0.80
null_countMethod · 0.80
nameMethod · 0.45
getMethod · 0.45
iterMethod · 0.45
mapMethod · 0.45
is_emptyMethod · 0.45
lenMethod · 0.45