Skip to content

[GLUTEN-10559] Simplify StrictRule and remove unnecessary DummyLeafExec#10553

Closed
beliefer wants to merge 1 commit into
apache:mainfrom
beliefer:investigate
Closed

[GLUTEN-10559] Simplify StrictRule and remove unnecessary DummyLeafExec#10553
beliefer wants to merge 1 commit into
apache:mainfrom
beliefer:investigate

Conversation

@beliefer

@beliefer beliefer commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

This PR proposes to simplify StrictRule and remove unnecessary DummyLeafExec.
Fixes: #10559
This improvement can advance the perf of Spark driver. I paste the perf below.
Before this improvement, the benchmark of TPCDS SF1000 show below.

First Second Third. Avg Median
3091.7 s 3012.2 s 3100.7 s 3068.2 s 3034.5 s

Before this improvement, the benchmark of TPCDS SF1000 show below.

First Second Third. Avg Median
2996.5 s 2938.4 s 2945.9 s 2960.267 s 2948.6 s

The average perf advances 3.52% and the median perf advances 2.83%.

There is an example.
The original plan:

Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- Scan OneRowRelation[]

Before this PR, the transform process is as follows:
Because the mechanism of transfomUp, treat Scan OneRowRelation[] first. Scan OneRowRelation[] do not have any children, so nothing could be hidden.
Scan OneRowRelation[] cannot be offloaded, so the plan will not change. The current plan show below.

Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- Scan OneRowRelation[]

Because Scan OneRowRelation[] do not have any children, so nothing need restore from hidden.
So the plan will not change. The current plan show below.

Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- Scan OneRowRelation[]

Because the mechanism of transfomUp, treat Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L] now. The child Scan OneRowRelation[] would be hide.
So the plan changed. The current plan show below.

Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- DummyLeaf Scan OneRowRelation[]
   +- Scan OneRowRelation[]

After offload Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L], the plan would be ...

ProjectExecTransformer [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- DummyLeaf Scan OneRowRelation[]
   +- Scan OneRowRelation[]

Now restore the child from hidden. The plan would be ...

ProjectExecTransformer [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- Scan OneRowRelation[]

After this PR, the transform process is as follows:
Because the mechanism of transfomUp, treat Scan OneRowRelation[] first.
Scan OneRowRelation[] cannot be offloaded, so the plan will not change. The current plan show below.

Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- Scan OneRowRelation[]

Because the mechanism of transfomUp, treat Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L] now.
After offload Project [3 AS e#8L, 1 AS c#10, 2 AS d#9L], the plan would be ...

ProjectExecTransformer [3 AS e#8L, 1 AS c#10, 2 AS d#9L]
+- Scan OneRowRelation[]

How was this patch tested?

GA tests.

@github-actions github-actions Bot added the CORE works for Gluten Core label Aug 27, 2025
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@beliefer beliefer changed the title [Draft] Investigate the behavior of hideChildren [GLUTEN-10559] Simplify StrictRule and remove unnecessary DummyLeafExec Aug 27, 2025
@github-actions

Copy link
Copy Markdown

#10559

@beliefer

Copy link
Copy Markdown
Contributor Author

ping @zhztheplayer @zml1206

@zhztheplayer zhztheplayer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hiding the children helps simplifying the offloading process of one single node. For consecutive matching of different nodes, we normally add an individual "transform rule" for that. You can view VeloxRuleApi for more usage patterns.

May I know what led you to this attempt?

@beliefer

Copy link
Copy Markdown
Contributor Author

May I know what led you to this attempt?

Thank you! I know that. In fact, DummyLeafExec does not work well due to the transform up.
Please see LegacyOffload.

@zhztheplayer

Copy link
Copy Markdown
Member

DummyLeafExec does not work well due to the transform up.

I may lose the contexts... Would you elaborate on this? Thanks.

@beliefer

Copy link
Copy Markdown
Contributor Author

I may lose the contexts... Would you elaborate on this? Thanks.

Take an example, a ProjectExec has a child FileSourceScanExec. The StrictRule will transform FileSourceScanExec to FileSourceScanExecTransformer and then transform ProjectExec to ProjectExecTransformer due to transformUp.

When hiding the children of ProjectExec, the child of ProjectExec already be the ProjectExecTransformer, so StrictRule can't hide anything.

@zhztheplayer

Copy link
Copy Markdown
Member

When hiding the children of ProjectExec, the child of ProjectExec already be the ProjectExecTransformer

I still don't understand the example. Are you able to share the plans before and after the strict rule?

@beliefer

Copy link
Copy Markdown
Contributor Author

I still don't understand the example. Are you able to share the plans before and after the strict rule?

I added an example into PR's description.

@zml1206

zml1206 commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

OffloadOthers(), OffloadExchange(), and OffloadJoin() do not traverse the plan internally, so I also think DummyLeafExec is not necessary.

@zhztheplayer

Copy link
Copy Markdown
Member

OffloadOthers(), OffloadExchange(), and OffloadJoin() do not traverse the plan internally

Can we keep the hiding children logic in testing only? We should make sure the single node rules doesn't touch the children nodes to keep the logic atomic. If a rule matches and offloads a sub-tree, it should be placed in post-transform instead.

@zml1206

zml1206 commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

Can we keep the hiding children logic in testing only? We should make sure the single node rules doesn't touch the children nodes to keep the logic atomic. If a rule matches and offloads a sub-tree, it should be placed in post-transform instead.

I have no idea how to implement this test. I see that the trait OffloadSingleNode has added a note, is it sufficient?

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the stale stale label Oct 26, 2025
@beliefer

Copy link
Copy Markdown
Contributor Author

Please hold this one.

@github-actions github-actions Bot removed the stale stale label Oct 29, 2025
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the stale stale label Dec 14, 2025
@beliefer beliefer removed the stale stale label Dec 15, 2025
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the stale stale label Jan 30, 2026
@beliefer beliefer removed the stale stale label Jan 30, 2026
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the stale stale label Mar 17, 2026
@beliefer beliefer removed the stale stale label Mar 20, 2026
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions Bot added the stale stale label May 5, 2026
@github-actions

Copy link
Copy Markdown

This PR was auto-closed because it has been stalled for 10 days with no activity. Please feel free to reopen if it is still valid. Thanks.

@github-actions github-actions Bot closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core stale stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify StrictRule due to transform up

3 participants