adriangb commented on code in PR #27736:
URL: https://github.com/apache/datafusion/pull/27736#discussion_r4735614500


##########
datafusion/physical-expr-common/src/pruning.rs:
##########
@@ -5,14 +5,80 @@
 use arrow::array::{Array, NullArray, UInt64Array};
 use arrow::array::{ArrayRef, BooleanArray};
 use arrow::datatypes::{FieldRef, Schema, SchemaRef};
+use std::any::Any;
 use std::collections::HashSet;
+use std::fmt;
+use std::hash::{Hash, Hasher};
 use std::sync::Arc;
 
+use crate::physical_expr::PhysicalExpr;
 use datafusion_common::error::DataFusionError;
 use datafusion_common::stats::Precision;
 use datafusion_common::{Column, Statistics};
 use datafusion_common::{ColumnStatistics, ScalarValue};
 
+/// An expression that has its own statistics, such as `get_field(s, 'a')`,
+/// together with the binding that the statistics source returned for it.
+///
+/// The source creates the binding when the pruning predicate asks whether
+/// `expr` has statistics. The predicate then passes the same value back to
+/// the `*_for_expr` methods of [`PruningStatistics`]. So the source reads the
+/// statistics from its own binding and does not look `expr` up again.
+///
+/// Two values are equal when their expressions are equal. The binding is
+/// not compared.
+#[derive(Clone)]
+pub struct StatsExpr {
+    expr: Arc<dyn PhysicalExpr>,
+    binding: Arc<dyn Any + Send + Sync>,

Review Comment:
   This type erasure is a bit ugly



-- 
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]

Reply via email to