Skip to content

Implement tree explain for SortExec #15077

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

Merged
merged 5 commits into from
Mar 9, 2025
Merged

Conversation

irenjj
Copy link
Contributor

@irenjj irenjj commented Mar 8, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Mar 8, 2025
Copy link
Contributor

@2010YOUY01 2010YOUY01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM, thank you. I left a small suggestion on fields name.

}
DisplayFormatType::TreeRender => match self.fetch {
Some(fetch) => {
writeln!(f, "fetch={fetch}")?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
writeln!(f, "fetch={fetch}")?;
writeln!(f, "limit={fetch}")?;

I think fetch is more often to be used in implementation, at plan level maybe 'limit' is better 🤔

DisplayFormatType::TreeRender => match self.fetch {
Some(fetch) => {
writeln!(f, "fetch={fetch}")?;
writeln!(f, "sort=[{}]", self.expr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort keys?

Comment on lines +557 to +559
06)│ sort keys: │
07)│ [string_col@1 ASC NULLS │
08)│ LAST] │
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is some way to avoid the redundancy of sort keys 🤔

For example I think this would be look better (not sure how to do it)

01)┌───────────────────────────┐
02)│          SortExec         │
03)│    --------------------   │
07)│   string_col@1 ASC NULLS  │
08)│            LAST           │
05)│                           │
04)│          limit: 1         │
09)└─────────────┬─────────────┘

Copy link
Contributor Author

@irenjj irenjj Mar 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to handle cases that are not in KV format. Other prs may have similar issues too, maybe we can handle it in the next pr, filed: #15098

@alamb
Copy link
Contributor

alamb commented Mar 9, 2025

I merged up to resolve a conflict

@alamb alamb merged commit 416feff into apache:main Mar 9, 2025
24 checks passed
@irenjj irenjj deleted the explain_sortexec branch March 13, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement tree explain for SortExec
3 participants