calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Beikov <>
Subject Materialization left join rewrite
Date Sun, 20 Aug 2017 19:25:05 GMT
I just discovered that queries containing left joins aren't rewritten 
when materializations are available and wondered why that is a 
limitation. I looked a bit into the implementation and found out that 

org.apache.calcite.rel.metadata.RelMetadataQuery) returns null when 
encountering a non-inner join.

For an inner join, the method returns essentially the join predicate, so 
I thought a left join should be similar. How about returning an OR node 
that asserts input refs of "outer-joined" tables are null if unmatched?

Let's consider an example query like "from emp e left join dept d on 
e.deptno = d.deptno"

If the join were an inner join, the return would be "=(e.deptno, 
d.deptno)". In case of a left join I'd suppose it returns 
"OR(IS_NULL(d.deptno),=(e.deptno, d.deptno))". Would that be sufficient 
to implement left join support or do you have something different in 
mind? I couldn't find a ticket for that particular case to discuss a 
possible implementation so please direct me if you already tracked that 


Mit freundlichen Grüßen,
*Christian Beikov*

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message