Skip to content

Fix FilterExec tree render missing fetch display#21230

Merged
zhuqi-lucas merged 1 commit intoapache:mainfrom
zhuqi-lucas:fix/filter-tree-render-fetch
Mar 30, 2026
Merged

Fix FilterExec tree render missing fetch display#21230
zhuqi-lucas merged 1 commit intoapache:mainfrom
zhuqi-lucas:fix/filter-tree-render-fetch

Conversation

@zhuqi-lucas
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #21229

Rationale for this change

When FilterExec has a fetch value (from limit pushdown), EXPLAIN FORMAT TREE does not show it, while EXPLAIN (default/verbose) correctly shows fetch=N. This makes the tree format output incomplete and can be confusing when debugging query plans.

What changes are included in this PR?

  • Add fetch display to FilterExec::fmt_as for TreeRender format
  • Add sqllogictest to verify fetch appears in tree format output

How are these changes tested?

  • Existing limit sqllogictests pass
  • New sqllogictest added to verify fetch is shown in EXPLAIN FORMAT TREE

Are these changes safe?

Yes — display-only change, no execution logic affected.

Copilot AI review requested due to automatic review settings March 29, 2026 09:39
@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) physical-plan Changes to the physical-plan crate labels Mar 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an inconsistency in DataFusion’s physical plan TreeRender formatting by ensuring FilterExec displays its pushed-down fetch limit, making EXPLAIN FORMAT TREE output more complete and consistent with the default/verbose formats.

Changes:

  • Update FilterExec::fmt_as for DisplayFormatType::TreeRender to append , fetch=N when fetch is present.
  • Add a new sqllogictest case asserting fetch appears in EXPLAIN FORMAT TREE output for a FilterExec node.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
datafusion/physical-plan/src/filter.rs Adds fetch rendering to FilterExec’s TreeRender formatting.
datafusion/sqllogictest/test_files/limit.slt Adds regression coverage for TreeRender output including fetch on FilterExec.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zhuqi-lucas zhuqi-lucas force-pushed the fix/filter-tree-render-fetch branch from 424ef47 to 2e8c43e Compare March 29, 2026 10:29
Copy link
Copy Markdown
Member

@xiedeyantu xiedeyantu left a comment

Choose a reason for hiding this comment

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

LGTM!

@zhuqi-lucas zhuqi-lucas force-pushed the fix/filter-tree-render-fetch branch from 2e8c43e to 101be80 Compare March 30, 2026 03:26
@github-actions github-actions bot added the physical-expr Changes to the physical-expr crates label Mar 30, 2026
When `FilterExec` has a `fetch` (limit pushed down), the `TreeRender`
display format does not show it, while `Default`/`Verbose` formats do.
This makes `EXPLAIN FORMAT TREE` output incomplete for queries with
LIMIT pushed into FilterExec.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@zhuqi-lucas zhuqi-lucas force-pushed the fix/filter-tree-render-fetch branch from 101be80 to 851055f Compare March 30, 2026 05:25
@github-actions github-actions bot removed the physical-expr Changes to the physical-expr crates label Mar 30, 2026
@zhuqi-lucas zhuqi-lucas added this pull request to the merge queue Mar 30, 2026
Merged via the queue into apache:main with commit 2aab559 Mar 30, 2026
33 of 34 checks passed
@zhuqi-lucas zhuqi-lucas deleted the fix/filter-tree-render-fetch branch March 30, 2026 07:46
@zhuqi-lucas
Copy link
Copy Markdown
Contributor Author

Thanks @xiedeyantu @2010YOUY01 @xudong963 for review, merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FilterExec TreeRender format missing fetch display

5 participants