Skip to content

[GLUTEN-11550][VL] Enable GlutenLogicalPlanTagInSparkPlanSuite (150/150 tests)#11833

Open
baibaichen wants to merge 1 commit intoapache:mainfrom
baibaichen:fix/11550-logical-plan-tag
Open

[GLUTEN-11550][VL] Enable GlutenLogicalPlanTagInSparkPlanSuite (150/150 tests)#11833
baibaichen wants to merge 1 commit intoapache:mainfrom
baibaichen:fix/11550-logical-plan-tag

Conversation

@baibaichen
Copy link
Copy Markdown
Contributor

@baibaichen baibaichen commented Mar 26, 2026

What changes were proposed in this pull request?

Enable GlutenLogicalPlanTagInSparkPlanSuite which was disabled (RUN ABORTED) on Spark 4.0/4.1. All 150 TPCDS queries now pass.

Root cause: Gluten's offload rules replace Spark physical plan nodes with Transformer nodes but don't propagate LOGICAL_PLAN_TAG. This tag links physical nodes back to their logical plan origins and is used by AQE, explain, and fallback reporting. Spark's LogicalPlanTagInSparkPlanSuite (extends TPCDSQuerySuite) verifies this linkage across all 150 TPCDS queries.

Core fixes (3 files in gluten-core / gluten-substrait):

  1. OffloadSingleNode.offloadAndPropagateTag: new helper that offloads a node and propagates LOGICAL_PLAN_TAG using setTagValue (non-recursive, to avoid incorrectly tagging Exchange nodes).
  2. LegacyOffload / HeuristicTransform.Simple: use offloadAndPropagateTag instead of bare rule.offload.
  3. PushDownFilterToScan: copyTagsFrom after withNewPushdownFilters (case class copy() loses tags).

Test suite changes (2 files, identical for spark40/spark41):

  • Override checkGeneratedCode with Gluten-aware checkGlutenLogicalPlanTag that recognizes Transformer node types (joins, aggregates, windows, scans, exchanges, etc.).
  • For scan trees, find logical plan tag from any node in the tree (not just root), since rewrite rules may create new Project/Filter without tags.

How was this patch tested?

  • spark41: 150/150 passed, 0 failed
  • spark40: 150/150 passed, 0 failed
  • GlutenTPCDSQuerySuite: 150/150 passed (no regression from core changes)
  • GlutenCollapseProjectExecTransformerSuite: 1/1 passed (tag preservation verified)

Related issue: #11550

@github-actions github-actions bot added the CORE works for Gluten Core label Mar 26, 2026
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@baibaichen baibaichen marked this pull request as draft March 26, 2026 13:02
@baibaichen baibaichen force-pushed the fix/11550-logical-plan-tag branch from 7c5a4a6 to 32ab1f2 Compare March 26, 2026 13:56
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@baibaichen baibaichen force-pushed the fix/11550-logical-plan-tag branch from 32ab1f2 to 5777d02 Compare March 27, 2026 09:16
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@baibaichen baibaichen force-pushed the fix/11550-logical-plan-tag branch from 5777d02 to 6a8f205 Compare March 27, 2026 09:18
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@baibaichen baibaichen force-pushed the fix/11550-logical-plan-tag branch from 6a8f205 to 88a4cfa Compare March 27, 2026 09:54
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

Root cause: Gluten's offload rules replace Spark physical plan nodes with
Transformer nodes but don't propagate LOGICAL_PLAN_TAG. This tag is used by
Spark's LogicalPlanTagInSparkPlanSuite to verify logical-physical plan linkage.

Three core fixes:
1. LegacyOffload: propagate LOGICAL_PLAN_TAG from original node to offloaded
   Transformer node using setTagValue (non-recursive to avoid tagging Exchange).
2. HeuristicTransform.Simple: same tag propagation for the simple offload path.
3. PushDownFilterToScan: copyTagsFrom when creating new scan via
   withNewPushdownFilters (case class copy loses tags).

Test suite overrides checkGeneratedCode with Gluten-aware version that:
- Recognizes Transformer node types (joins, aggregates, windows, scans, etc.)
- For scan trees, finds logical plan tag from any node in the tree (not just
  root), since rewrite rules may create new Project/Filter without tags.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baibaichen baibaichen force-pushed the fix/11550-logical-plan-tag branch from 88a4cfa to 371a213 Compare March 27, 2026 11:33
@github-actions
Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@baibaichen baibaichen marked this pull request as ready for review March 27, 2026 13:34
@baibaichen
Copy link
Copy Markdown
Contributor Author

@zhztheplayer please review

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

Labels

CORE works for Gluten Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant