Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ORCA] optimize eliminate self comparison
'PexprEliminateSelfComparison' only uses the 'pcrsNotNull' from the topmost expression to filter the nullable columns. This can lead the PexprEliminateSelfComparison cannot apply to the subquery properly. create table t1(a int not null, b int not null); create table t2(like t1); create table t3(like t1); select * from t2 left join (select t2.a , t2.b from t1, t2 where t1.a < t1.a) as t on t2. a = t.a; the plan for it from orca is Gather Motion 3:1 (slice1; segments: 3) -> Hash Left Join Hash Cond: (t2.a = t2_1.a) -> Seq Scan on t2 -> Hash -> Nested Loop Join Filter: true -> Seq Scan on t2 t2_1 -> Materialize -> Broadcast Motion 3:3 (slice2; segments: 3) -> Seq Scan on t1 Filter: (a < a) the self comparison in subquery is not eliminated. This commit is to optimize it by fetching 'pcrsNotNull' from the current logical expression and apply them to its child scalar expression.
- Loading branch information