Resending. Sent earlier mail to 'incubator' mailing list by mistake. Sorry about that.
On Sun, Apr 24, 2016 at 8:27 PM, Amogh Margoor <[email protected]> wrote: > Hi, > In Quark, we have tried to optimize join queries using auto detection of > materialised views. For instance, when we have materialised view of table > 'X' named 'X_part' defined by query: " select * from X where X.a > > '2016-01-01' " then we expect following query to be optimised by 'X_part': > > select * from X inner join Y on X.id = Y.xid inner join Z on Y.id=Z.yid > where X.a > '2016-02-02' and Y.b = "Bangalore" > > There were couple of changes required to do this: > 1. Add a new Rule for Filter on TableScan. Basically, after predicate has > been pushed through join onto table scan, new rule checks if it can be > optimised by Materialised View. > > https://github.com/qubole/quark/blob/master/optimizer/src/main/java/com/qubole/quark/planner/MaterializedViewFilterScanRule.java > > 2. Add a new Unify rule to MaterialisedSubstitutionVisitor: > > https://github.com/qubole/incubator-calcite/commit/2d031d14d23810291377d92dc5ef2eaa515d35b7 > > If this change will be useful for Calcite, then I can raise relevant PR > with test cases to contribute it back. Just let us know. > > Regards, > Amogh >
