You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hussein Awala (Jira)" <ji...@apache.org> on 2026/10/10 21:27:00 UTC

[jira] [Created] (SPARK-60135) Prune unnecessary subquery-expression traversal in DeduplicateRelations

Hussein Awala created SPARK-60135:
-------------------------------------

             Summary: Prune unnecessary subquery-expression traversal in DeduplicateRelations
                 Key: SPARK-60135
                 URL: https://issues.apache.org/jira/browse/SPARK-60135
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Hussein Awala


DeduplicateRelations.deduplicate unconditionally calls plan.transformExpressions with a partial function that matches only SubqueryExpression. This also walks operator expressions that cannot contain a subquery.

QueryPlan propagates expression tree-pattern bits, and SubqueryExpression inherits the PLAN_EXPRESSION marker. A narrowly scoped optimization can skip this expression scan when that marker is absent from the plan, and prune expression subtrees without the marker when the scan is needed.

The relation-renewal traversal, attribute remapping, subquery recursion and processing order must remain unchanged. The expression transform must retain UnknownRuleId because its closure reads and updates traversal state; ineffective-rule memoization would be inappropriate here.

Suggested validation uses generic Catalyst plans: projects containing arithmetic/literal expressions, subqueries wrapped in aliases or other expressions, nested/correlated subqueries, and the same subquery object reused in multiple positions.

This is narrower than SPARK-49881 (conditional rule-wide skipping), and distinct from SPARK-59452 (wide UNION branch comparisons and related synthetic self-join overhead).

Generated-by: Pi Coding Agent 1.1.0




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org