Kent Yao created SPARK-55654:
--------------------------------

             Summary: Enable TreePattern pruning for EliminateSubqueryAliases 
and ResolveInlineTables
                 Key: SPARK-55654
                 URL: https://issues.apache.org/jira/browse/SPARK-55654
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 4.2.0
            Reporter: Kent Yao


Replace AlwaysProcess.fn with pattern-based pruning in two Analyzer rules:

1. EliminateSubqueryAliases: Use _.containsPattern(SUBQUERY_ALIAS)
   - Skips entire plan traversal when no SubqueryAlias nodes exist
   - Common in resolved plans after initial resolution passes

2. ResolveInlineTables: Use _.containsPattern(INLINE_TABLE_EVAL)
   - Skips traversal when no UnresolvedInlineTable nodes exist
   - Inline tables are rare; most queries never contain them

Also adds INLINE_TABLE_EVAL to UnresolvedInlineTable.nodePatterns, which was 
previously only defined on ResolvedInlineTable. Without this, the pruning 
condition could never be satisfied for unresolved inline tables.

Both rules previously used AlwaysProcess.fn, forcing full tree traversal on 
every fixedPoint iteration even when no matching nodes existed. TreePatternBits 
propagation enables O(1) root-level short-circuit.



--
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