calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Beikov <>
Subject Re: Materialization left join rewrite
Date Thu, 24 Aug 2017 14:07:55 GMT
I created to track 
this issue.

Apart from tests that are already failing on master, it seems that my 
implementation( doesn't fail 
any other tests. I'd love some feedback as that is a very essential 
feature for me.

Mit freundlichen Grüßen,
*Christian Beikov*
Am 24.08.2017 um 02:13 schrieb Julian Hyde:
> Jesus,
> Can you answer this question for Christian please? Seems like a reasonable use case,
and your area of expertise.
> Julian
>> On Aug 20, 2017, at 12:25 PM, Christian Beikov <>
>> 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.RelMdAllPredicates#getAllPredicates(org.apache.calcite.rel.core.Join,
org.apache.calcite.rel.metadata.RelMetadataQuery) returns null when encountering a non-inner
>> 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 issue.
>> -- 
>> Mit freundlichen Grüßen,
>> ------------------------------------------------------------------------
>> *Christian Beikov*

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