Gustavo de Morais created FLINK-39202:
-----------------------------------------

             Summary: Simplify COALESCE expressions referencing equi-join 
columns
                 Key: FLINK-39202
                 URL: https://issues.apache.org/jira/browse/FLINK-39202
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
    Affects Versions: 2.2.0
            Reporter: Gustavo de Morais
            Assignee: Gustavo de Morais
             Fix For: 2.3.0


Add a new planner rule SimplifyCoalesceWithEquiJoinConditionRule that replaces 
COALESCE(a, b) with a direct column reference when both arguments reference 
opposite sides of an equi-join condition.                                 
                                                            
  For example, SELECT COALESCE(b.id, a.id) FROM t1 a LEFT JOIN t2 b ON a.id = 
b.id simplifies to a.id, since the left side is always non-null in a LEFT JOIN. 
                          
                                                            
  The rule handles LEFT, RIGHT, and INNER joins, skips FULL OUTER, and supports 
Project and Calc nodes. Supports both batch and stream rule sets.



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

Reply via email to