calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Beikov <christian.bei...@gmail.com>
Subject Re: Materialization left join rewrite
Date Thu, 24 Aug 2017 00:21:03 GMT
FWIW I use an implementation of that idea locally and did a few 
end-to-end tests and it seems to work so far.

I can prepare a PR so we can discuss this if you tell me an issue number 
or that I should create one for this.


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 <christian.beikov@gmail.com>
wrote:
>>
>> 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
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 issue.
>>
>> -- 
>>
>> Mit freundlichen Grüßen,
>> ------------------------------------------------------------------------
>> *Christian Beikov*


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