Existing rules for duplication of filter conditions above joins which should not be pushed down by FilterIntoJoinRule ?

2023-09-26 Thread Ian Bertolacci
Hi, I was wondering if there exist any rules to duplicate filters which exist above the join, whose effect is dependent on the result of the join and therefore cannot be *pushed* below a join, but could be *duplicated* below the join. For example: `select … from A LEFT join B on … where B.field

Re: Existing rules for duplication of filter conditions above joins which should not be pushed down by FilterIntoJoinRule ?

2023-09-27 Thread Stamatis Zampetakis
Hey Ian, I don't think there is such a rule in Calcite but you may find similar ideas in rules present in other projects. In Hive for instance, there is the HivePreFilteringRule [1, 2] that pushes "redundantly" some filters below other operations in the tree. What is inherently problematic with a

Re: Existing rules for duplication of filter conditions above joins which should not be pushed down by FilterIntoJoinRule ?

2023-09-27 Thread Julian Hyde
I like the idea of redundant filters. We should probably add a new kind of metadata so that one node can see that a filter is redundant. I’m not sure how that metadata would look. A well chosen use case will help us design it. Does anyone have one? > On Sep 27, 2023, at 1:40 AM, Stamatis Zampet

Re: Existing rules for duplication of filter conditions above joins which should not be pushed down by FilterIntoJoinRule ?

2023-09-30 Thread Julian Hyde
Thanks, Ian. That’s useful. My concern with duplication of filter conditions is that we give the lower relational expression permission to ignore them. Suppose we have a query (Q1): select * from emp left join dept using (deptno) where myPredicate(dept.dname) We could duplicate th

Re: Existing rules for duplication of filter conditions above joins which should not be pushed down by FilterIntoJoinRule ?

2023-10-01 Thread LakeShen
In the Trino,there are two kinds of predicates if the predicates could be pushed: 1. unenforced predicate 2. enforced predicate unenforced predicate means that a predicate could be pushed down, but the bottom layer will not guarantee that the data completely conforms to the predicate, so we still n

RE: Re: Existing rules for duplication of filter conditions above joins which should not be pushed down by FilterIntoJoinRule ?

2023-09-27 Thread Ian Bertolacci
Hi Stamatis, Thanks for pointing out those rules. Unfortunately, I think my initial premise was wrong. Thanks! -Ian (elaborating mostly for future readers) For example, say I have these two tables: T1 | Id | ForeignKey | 1 | 10 | 2 | 20 | 3 | 30 | 4 | 40 T2 | Id | SomeValue | 10 | 123 | 20