Implement tree explain for PartialSortExec#15066
Merged
alamb merged 6 commits intoapache:mainfrom Mar 9, 2025
Merged
Conversation
alamb
reviewed
Mar 7, 2025
| // TODO: collect info | ||
| write!(f, "") | ||
| let common_prefix_length = self.common_prefix_length; | ||
| match self.fetch { |
Contributor
There was a problem hiding this comment.
I recommend we make this simpler -- specifically the common_prefix_length is too detailed for the TreeRender per
datafusion/datafusion/physical-plan/src/display.rs
Lines 48 to 75 in 2458693
I also think the TopK / Fetch thing is confusing
What I would recommend is:
01)┌───────────────────────────┐
02)│ PartialSortExec │
03)│ -------------------- │
07)│ sort: │
08)│[a@1 ASC NULLS LAST, b@2...│
09)└─────────────┬─────────────┘
10)┌─────────────┴─────────────┐
11)│ StreamingTableExec │
12)└───────────────────────────┘
And
01)┌───────────────────────────┐
02)│ PartialSortExec │
03)│ -------------------- │
04)│ fetch=50 │
09)│ sort: │
10)│[a@1 ASC NULLS LAST, b@2...│
11)└─────────────┬─────────────┘
Here is what duckdb does for refernece:
D create table foo (x int);
D insert into foo values (1);
D explain select * from foo order by x;
┌─────────────────────────────┐
│┌───────────────────────────┐│
││ Physical Plan ││
│└───────────────────────────┘│
└─────────────────────────────┘
┌───────────────────────────┐
│ PROJECTION │
│ ──────────────────── │
│__internal_decompress_integ│
│ ral_integer(#0, 1) │
│ │
│ ~1 Rows │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ ORDER_BY │
│ ──────────────────── │
│ memory.main.foo.x ASC │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ PROJECTION │
│ ──────────────────── │
│__internal_compress_integra│
│ l_utinyint(#0, 1) │
│ │
│ ~1 Rows │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│ SEQ_SCAN │
│ ──────────────────── │
│ Table: foo │
│ Type: Sequential Scan │
│ Projections: x │
│ │
│ ~1 Rows │
└───────────────────────────┘
alamb
approved these changes
Mar 8, 2025
| DisplayFormatType::TreeRender => match self.fetch { | ||
| Some(fetch) => { | ||
| writeln!(f, "limit={fetch}")?; | ||
| writeln!(f, "sort keys=[{}]", self.expr) |
Contributor
There was a problem hiding this comment.
I recommend avoiding the [ and ] if possible
5816313 to
2006ebb
Compare
alamb
approved these changes
Mar 9, 2025
Contributor
|
Thanks again @irenjj |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
PartialSortExec#15064Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?