Skip to content

Commit 9754542

Browse files
committed
refactor(query): use trait to refactor physical plan
1 parent fbdce99 commit 9754542

File tree

83 files changed

+178
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+178
-10
lines changed

src/query/service/src/physical_plans/format/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ impl<'a> PhysicalFormat for SimplePhysicalFormat<'a> {
222222
self.meta
223223
}
224224

225+
#[recursive::recursive]
225226
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
226227
let mut children = vec![];
227228
for child in self.children.iter() {
@@ -234,6 +235,7 @@ impl<'a> PhysicalFormat for SimplePhysicalFormat<'a> {
234235
))
235236
}
236237

238+
#[recursive::recursive]
237239
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
238240
if self.children.len() == 1 {
239241
return self.children[0].format_join(ctx);
@@ -250,6 +252,7 @@ impl<'a> PhysicalFormat for SimplePhysicalFormat<'a> {
250252
))
251253
}
252254

255+
#[recursive::recursive]
253256
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
254257
if self.children.len() == 1 {
255258
return self.children[0].partial_format(ctx);

src/query/service/src/physical_plans/format/format_add_stream_column.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@ impl<'a> PhysicalFormat for AddStreamColumnFormatter<'a> {
3636
self.inner.get_meta()
3737
}
3838

39+
#[recursive::recursive]
3940
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4041
// ignore self
4142
let input_formatter = self.inner.input.formatter()?;
4243
input_formatter.dispatch(ctx)
4344
}
4445

46+
#[recursive::recursive]
4547
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4648
self.inner.input.formatter()?.format_join(ctx)
4749
}
4850

51+
#[recursive::recursive]
4952
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
5053
self.inner.input.formatter()?.partial_format(ctx)
5154
}

src/query/service/src/physical_plans/format/format_aggregate_expand.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<'a> PhysicalFormat for AggregateExpandFormatter<'a> {
3838
self.inner.get_meta()
3939
}
4040

41+
#[recursive::recursive]
4142
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4243
let sets = self
4344
.inner
@@ -77,10 +78,12 @@ impl<'a> PhysicalFormat for AggregateExpandFormatter<'a> {
7778
))
7879
}
7980

81+
#[recursive::recursive]
8082
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
8183
self.inner.input.formatter()?.format_join(ctx)
8284
}
8385

86+
#[recursive::recursive]
8487
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
8588
self.inner.input.formatter()?.partial_format(ctx)
8689
}

src/query/service/src/physical_plans/format/format_aggregate_final.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl<'a> PhysicalFormat for AggregateFinalFormatter<'a> {
3939
self.inner.get_meta()
4040
}
4141

42+
#[recursive::recursive]
4243
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4344
let group_by = self
4445
.inner
@@ -82,10 +83,12 @@ impl<'a> PhysicalFormat for AggregateFinalFormatter<'a> {
8283
))
8384
}
8485

86+
#[recursive::recursive]
8587
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
8688
self.inner.input.formatter()?.format_join(ctx)
8789
}
8890

91+
#[recursive::recursive]
8992
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
9093
self.inner.input.formatter()?.partial_format(ctx)
9194
}

src/query/service/src/physical_plans/format/format_aggregate_partial.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl<'a> PhysicalFormat for AggregatePartialFormatter<'a> {
3939
self.inner.get_meta()
4040
}
4141

42+
#[recursive::recursive]
4243
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4344
let group_by = self
4445
.inner
@@ -77,10 +78,12 @@ impl<'a> PhysicalFormat for AggregatePartialFormatter<'a> {
7778
))
7879
}
7980

81+
#[recursive::recursive]
8082
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
8183
self.inner.input.formatter()?.format_join(ctx)
8284
}
8385

86+
#[recursive::recursive]
8487
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
8588
self.inner.input.formatter()?.partial_format(ctx)
8689
}

src/query/service/src/physical_plans/format/format_async_func.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<'a> PhysicalFormat for AsyncFunctionFormatter<'a> {
3838
self.inner.get_meta()
3939
}
4040

41+
#[recursive::recursive]
4142
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4243
let output_schema = self.inner.output_schema()?;
4344
let mut children = vec![FormatTreeNode::new(format!(
@@ -58,10 +59,12 @@ impl<'a> PhysicalFormat for AsyncFunctionFormatter<'a> {
5859
))
5960
}
6061

62+
#[recursive::recursive]
6163
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
6264
self.inner.input.formatter()?.format_join(ctx)
6365
}
6466

67+
#[recursive::recursive]
6568
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
6669
self.inner.input.formatter()?.partial_format(ctx)
6770
}

src/query/service/src/physical_plans/format/format_cache_scan.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<'a> PhysicalFormat for CacheScanFormatter<'a> {
3838
self.inner.get_meta()
3939
}
4040

41+
#[recursive::recursive]
4142
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4243
let mut children = Vec::with_capacity(2);
4344
children.push(FormatTreeNode::new(format!(

src/query/service/src/physical_plans/format/format_chunk_cast_schema.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,18 @@ impl<'a> PhysicalFormat for ChunkCastSchemaFormatter<'a> {
3636
self.inner.get_meta()
3737
}
3838

39+
#[recursive::recursive]
3940
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4041
let input_formatter = self.inner.input.formatter()?;
4142
input_formatter.dispatch(ctx)
4243
}
4344

45+
#[recursive::recursive]
4446
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4547
self.inner.input.formatter()?.format_join(ctx)
4648
}
4749

50+
#[recursive::recursive]
4851
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4952
self.inner.input.formatter()?.partial_format(ctx)
5053
}

src/query/service/src/physical_plans/format/format_chunk_eval_scalar.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<'a> PhysicalFormat for ChunkEvalScalarFormatter<'a> {
3838
self.inner.get_meta()
3939
}
4040

41+
#[recursive::recursive]
4142
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4243
if self.inner.eval_scalars.iter().all(|x| x.is_none()) {
4344
let input_formatter = self.inner.input.formatter()?;
@@ -70,10 +71,12 @@ impl<'a> PhysicalFormat for ChunkEvalScalarFormatter<'a> {
7071
))
7172
}
7273

74+
#[recursive::recursive]
7375
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
7476
self.inner.input.formatter()?.format_join(ctx)
7577
}
7678

79+
#[recursive::recursive]
7780
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
7881
self.inner.input.formatter()?.partial_format(ctx)
7982
}

src/query/service/src/physical_plans/format/format_chunk_fill_and_reorder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@ impl<'a> PhysicalFormat for ChunkFillAndReorderFormatter<'a> {
3636
self.inner.get_meta()
3737
}
3838

39+
#[recursive::recursive]
3940
fn format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4041
// ignore self
4142
let input_formatter = self.inner.input.formatter()?;
4243
input_formatter.dispatch(ctx)
4344
}
4445

46+
#[recursive::recursive]
4547
fn format_join(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
4648
self.inner.input.formatter()?.format_join(ctx)
4749
}
4850

51+
#[recursive::recursive]
4952
fn partial_format(&self, ctx: &mut FormatContext<'_>) -> Result<FormatTreeNode<String>> {
5053
self.inner.input.formatter()?.partial_format(ctx)
5154
}

0 commit comments

Comments
 (0)