Skip to content

Commit 051ca96

Browse files
committed
feature(explain): add a simple explain join to display the join orders
1 parent 025cac0 commit 051ca96

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/query/service/src/interpreters/interpreter_explain.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ impl ExplainInterpreter {
212212
plan: &PhysicalPlan,
213213
metadata: &MetadataRef,
214214
) -> Result<Vec<DataBlock>> {
215-
let prof = ProfSpanSetRef::default();
216-
let result = plan.format_join(metadata, &prof)?.format_pretty()?;
215+
let result = plan.format_join(metadata)?.format_pretty()?;
217216
let line_split_result: Vec<&str> = result.lines().collect();
218217
let formatted_plan = StringType::from_data(line_split_result);
219218
Ok(vec![DataBlock::new_from_columns(vec![formatted_plan])])

src/query/sql/src/executor/format.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ impl PhysicalPlan {
5656
to_format_tree(self, &metadata, &prof_span_set)
5757
}
5858

59-
pub fn format_join(
60-
&self,
61-
metadata: &MetadataRef,
62-
prof_span_set: &ProfSpanSetRef,
63-
) -> Result<FormatTreeNode<String>> {
59+
pub fn format_join(&self, metadata: &MetadataRef) -> Result<FormatTreeNode<String>> {
6460
match self {
6561
PhysicalPlan::TableScan(plan) => {
6662
if plan.table_index == DUMMY_TABLE_INDEX {
@@ -82,8 +78,8 @@ impl PhysicalPlan {
8278
))
8379
}
8480
PhysicalPlan::HashJoin(plan) => {
85-
let build_child = plan.build.format_join(metadata, prof_span_set)?;
86-
let probe_child = plan.probe.format_join(metadata, prof_span_set)?;
81+
let build_child = plan.build.format_join(metadata)?;
82+
let probe_child = plan.probe.format_join(metadata)?;
8783

8884
let children = vec![
8985
FormatTreeNode::with_children("Build".to_string(), vec![build_child]),
@@ -98,7 +94,7 @@ impl PhysicalPlan {
9894
other => {
9995
let children = other
10096
.children()
101-
.map(|child| child.format_join(metadata, prof_span_set))
97+
.map(|child| child.format_join(metadata))
10298
.collect::<Result<Vec<FormatTreeNode<String>>>>()?;
10399

104100
if children.len() == 1 {

0 commit comments

Comments
 (0)