gabotechs commented on code in PR #21112:
URL: https://github.com/apache/datafusion/pull/21112#discussion_r2976630070


##########
datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:
##########
@@ -19,33 +19,89 @@ use crate::logical_plan::consumer::SubstraitConsumer;
 use crate::logical_plan::consumer::from_substrait_literal;
 use crate::logical_plan::consumer::from_substrait_named_struct;
 use crate::logical_plan::consumer::utils::ensure_schema_compatibility;
+use async_trait::async_trait;
+use datafusion::arrow::datatypes::SchemaRef;
+use datafusion::catalog::{Session, TableProvider};
+use datafusion::common::stats::Precision;
 use datafusion::common::{
-    DFSchema, DFSchemaRef, TableReference, not_impl_err, plan_err,
+    DFSchema, DFSchemaRef, Statistics, TableReference, not_impl_err, plan_err,
     substrait_datafusion_err, substrait_err,
 };
 use datafusion::datasource::provider_as_source;
+use datafusion::logical_expr::TableType;
 use datafusion::logical_expr::utils::split_conjunction_owned;
 use datafusion::logical_expr::{
     EmptyRelation, Expr, LogicalPlan, LogicalPlanBuilder, Values,
 };
+use datafusion::physical_plan::ExecutionPlan;
+use std::any::Any;
 use std::sync::Arc;
 use substrait::proto::expression::MaskExpression;
 use substrait::proto::read_rel::ReadType;
 use substrait::proto::read_rel::local_files::file_or_files::PathType::UriFile;
 use substrait::proto::{Expression, ReadRel};
 use url::Url;
 
+#[derive(Debug)]
+struct StatisticsOverrideTableProvider {
+    inner: Arc<dyn TableProvider>,
+    statistics: Statistics,
+}

Review Comment:
   An "override" or a "wrapper" is probably not the most future proof way of 
enhancing a node with statistics, it's a bit hacky for it to be committed here.
   
   For example, this can mess with the `downcast()`, as the specific struct 
implementation of the `TableProvider` is now a different one.



##########
datafusion/substrait/src/logical_plan/consumer/rel/read_rel.rs:
##########


Review Comment:
   I get the impression that a less opinionated approach would be to pass down 
the hints as another argument to `consumer.resolve_table_ref(`, and let 
implementors of `resolve_table_ref` decide wether they want to use the provided 
statistics or not in their specific `TableProvider` implementation.



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