Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement protobuf serialization for AnalyzeExec #7574

Merged
merged 5 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions datafusion/core/src/physical_plan/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ impl AnalyzeExec {
schema,
}
}

/// access to verbose
pub fn verbose(&self) -> bool {
self.verbose
}

/// access to show_statistics
pub fn show_statistics(&self) -> bool {
self.show_statistics
}

/// The input plan
pub fn input(&self) -> &Arc<dyn ExecutionPlan> {
&self.input
}
}

impl DisplayAs for AnalyzeExec {
Expand Down
8 changes: 8 additions & 0 deletions datafusion/proto/proto/datafusion.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ message PhysicalPlanNode {
ExplainExecNode explain = 20;
SortPreservingMergeExecNode sort_preserving_merge = 21;
NestedLoopJoinExecNode nested_loop_join = 22;
AnalyzeExecNode analyze = 23;
}
}

Expand Down Expand Up @@ -1345,6 +1346,13 @@ message ExplainExecNode {
bool verbose = 3;
}

message AnalyzeExecNode {
bool verbose = 1;
bool show_statistics = 2;
PhysicalPlanNode input = 3;
Schema schema = 4;
}

message CrossJoinExecNode {
PhysicalPlanNode left = 1;
PhysicalPlanNode right = 2;
Expand Down
99 changes: 71 additions & 28 deletions datafusion/proto/src/generated/prost.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions datafusion/proto/src/physical_plan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use datafusion::execution::FunctionRegistry;
use datafusion::logical_expr::WindowFrame;
use datafusion::physical_plan::aggregates::{create_aggregate_expr, AggregateMode};
use datafusion::physical_plan::aggregates::{AggregateExec, PhysicalGroupBy};
use datafusion::physical_plan::analyze::AnalyzeExec;
use datafusion::physical_plan::coalesce_batches::CoalesceBatchesExec;
use datafusion::physical_plan::coalesce_partitions::CoalescePartitionsExec;
use datafusion::physical_plan::empty::EmptyExec;
Expand Down Expand Up @@ -778,6 +779,20 @@ impl AsExecutionPlan for PhysicalPlanNode {
&join_type.into(),
)?))
}
PhysicalPlanType::Analyze(analyze) => {
let input: Arc<dyn ExecutionPlan> = into_physical_plan(
&analyze.input,
registry,
runtime,
extension_codec,
)?;
Ok(Arc::new(AnalyzeExec::new(
analyze.verbose,
analyze.show_statistics,
input,
Arc::new(analyze.schema.as_ref().unwrap().try_into()?),
)))
}
}
}

Expand Down Expand Up @@ -825,6 +840,21 @@ impl AsExecutionPlan for PhysicalPlanNode {
},
))),
})
} else if let Some(exec) = plan.downcast_ref::<AnalyzeExec>() {
let input = protobuf::PhysicalPlanNode::try_from_physical_plan(
exec.input().to_owned(),
extension_codec,
)?;
Ok(protobuf::PhysicalPlanNode {
physical_plan_type: Some(PhysicalPlanType::Analyze(
protobuf::AnalyzeExecNode {
verbose: exec.verbose(),
show_statistics: exec.show_statistics(),
input: Some(Box::new(input)),
schema: Some(exec.schema().as_ref().try_into()?),
},
)),
})
} else if let Some(exec) = plan.downcast_ref::<FilterExec>() {
let input = protobuf::PhysicalPlanNode::try_from_physical_plan(
exec.input().to_owned(),
Expand Down
Loading