[
https://issues.apache.org/jira/browse/SPARK-62383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SPARK-62383:
-----------------------------------
Labels: pull-request-available (was: )
> RemoveRedundantAliases drops aliases that keep Union branches free of
> duplicate ExprIds
> ---------------------------------------------------------------------------------------
>
> Key: SPARK-62383
> URL: https://issues.apache.org/jira/browse/SPARK-62383
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 5.0.0
> Reporter: XiDuo You
> Priority: Major
> Labels: pull-request-available
>
> RemoveRedundantAliases can leave a non-first Union branch with duplicate
> ExprIds in its
> output, which makes the Union unresolved and fails optimization with
> PLAN_VALIDATION_FAILED_RULE_IN_BATCH.
> Cases:
> 1. An Alias that deduplicates the branch output is stripped together with the
> others when it
> sits below a non-Project barrier (Repartition/Sort/Filter/GlobalLimit) or
> when a second
> alias wraps the same attribute, e.g.
> SELECT 1L AS id, 2L AS id UNION ALL (SELECT /*+ REPARTITION(2) */ 0L AS
> id, id AS id FROM
> range(10, 12)). This also breaks FULL OUTER JOIN with a false condition
> once it is rewritten
> to a UNION ALL (SPARK-53618).
> 2. shouldRemoveAliasesUnderUnion skips a branch subtree as a whole, so the
> ExprId-preserving
> Alias that EliminateSerialization inserts around a collapsed
> DeserializeToObject/SerializeFromObject pair reaches execution as an
> unsupported ObjectType
> projection, which fails in both codegen and the interpreted fallback.
> 3. The first-child flag is not consumed when the first child is skipped, so a
> later child is
> treated as the first one.
> Fix: always traverse a branch that contains an Alias; protect the first child
> with its output
> attribute set, and for the other children protect only the k - 1 attributes
> whose stripped
> positions collide with an ExprId already taken. Retention is bounded by a
> small retry cap, and
> the remaining case protects the whole branch output, so no inner alias or
> ObjectType projection
> survives either way.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]