Blizzara commented on code in PR #13803: URL: https://github.com/apache/datafusion/pull/13803#discussion_r1890180571
########## datafusion/substrait/src/logical_plan/consumer.rs: ########## @@ -94,13 +102,467 @@ use substrait::proto::{ join_rel, plan_rel, r#type, read_rel::ReadType, rel::RelType, - rel_common, set_rel, + rel_common, sort_field::{SortDirection, SortKind::*}, - AggregateFunction, Expression, NamedStruct, Plan, Rel, RelCommon, Type, + AggregateFunction, AggregateRel, ConsistentPartitionWindowRel, CrossRel, ExchangeRel, + Expression, ExtensionLeafRel, ExtensionMultiRel, ExtensionSingleRel, FetchRel, + FilterRel, JoinRel, NamedStruct, Plan, ProjectRel, ReadRel, Rel, RelCommon, SetRel, + SortRel, Type, }; use substrait::proto::{ExtendedExpression, FunctionArgument, SortField}; -use super::state::SubstraitPlanningState; +#[async_trait] +/// This trait is used to consume Substrait plans, converting them into DataFusion Logical Plans. +/// It can be implemented by users to allow for custom handling of relations, expressions, etc. +/// +/// # Example Usage +/// +/// ``` +/// use async_trait::async_trait; +/// use datafusion::catalog::TableProvider; +/// use datafusion::common::{not_impl_err, substrait_err, DFSchema, ScalarValue, TableReference}; +/// use datafusion::error::Result; +/// use datafusion::execution::SessionState; +/// use datafusion::logical_expr::{Expr, LogicalPlan, LogicalPlanBuilder}; +/// use std::sync::Arc; +/// use substrait::proto; +/// use substrait::proto::{ExtensionLeafRel, FilterRel, ProjectRel}; +/// use datafusion::arrow::datatypes::DataType; +/// use datafusion::logical_expr::expr::ScalarFunction; +/// use datafusion_substrait::extensions::Extensions; +/// use datafusion_substrait::logical_plan::consumer::{ +/// from_project_rel, from_substrait_rel, from_substrait_rex, SubstraitConsumer +/// }; +/// +/// use datafusion_substrait::logical_plan::state::SubstraitPlanningState; Review Comment: do you need this? SubstraitPlanningState doesn't seem to be used anywhere in the code anymore afaict. Actually, if it's not used anymore after this, maybe remove the whole state.rs file as part of this PR? -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org