Skip to content

Commit

Permalink
docs(substrait): consume_rel and consume_expression docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
vbarua committed Jan 3, 2025
1 parent 04175bd commit 85b9543
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions datafusion/substrait/src/logical_plan/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ pub trait SubstraitConsumer: Send + Sync + Sized {
// These methods have default implementations calling the common handler code, to allow for users
// to re-use common handling logic.

/// All [Rel]s to be converted pass through this method.
/// You can provide your own implementation if you wish to customize the conversion behaviour.
async fn consume_rel(&self, rel: &Rel) -> Result<LogicalPlan> {
from_substrait_rel(self, rel).await
}
Expand Down Expand Up @@ -289,6 +291,8 @@ pub trait SubstraitConsumer: Send + Sync + Sized {
// These methods have default implementations calling the common handler code, to allow for users
// to re-use common handling logic.

/// All [Expression]s to be converted pass through this method.
/// You can provide your own implementation if you wish to customize the conversion behaviour.
async fn consume_expression(
&self,
expr: &Expression,
Expand Down Expand Up @@ -751,11 +755,9 @@ pub async fn from_substrait_plan_with_consumer(
1 => {
match plan.relations[0].rel_type.as_ref() {
Some(rt) => match rt {
plan_rel::RelType::Rel(rel) => {
Ok(consumer.consume_rel( rel).await?)
},
plan_rel::RelType::Rel(rel) => Ok(consumer.consume_rel(rel).await?),
plan_rel::RelType::Root(root) => {
let plan = consumer.consume_rel( root.input.as_ref().unwrap()).await?;
let plan = consumer.consume_rel(root.input.as_ref().unwrap()).await?;
if root.names.is_empty() {
// Backwards compatibility for plans missing names
return Ok(plan);
Expand Down

0 comments on commit 85b9543

Please sign in to comment.