etiennepelissier commented on code in PR #21112:
URL: https://github.com/apache/datafusion/pull/21112#discussion_r2982553563
##########
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:
Done in the updated version. StatisticsOverrideTableProvider is still used
by DefaultSubstraitConsumer as a fallback, but since the hint is now passed
through resolve_table_ref, custom implementors can return a provider with
statistics already embedded and avoid the wrapper entirely — which also
sidesteps the downcast issue.
--
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]