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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to