Re: Is it possible to retrieve materialized view query rewrite from Calcite Plan

2019-09-16 Thread XING JIN
I think it will work. I once did similar things and was playing around with VolcanoPlanner and RelOptMaterializations. Shubham Kumar 于2019年9月16日周一 下午8:32写道: > Hey everyone, > > Thank you for the help. > > @Stamatis, @Danny : Thanks for pointing out that the reltosql api should > be used

Re: Is it possible to retrieve materialized view query rewrite from Calcite Plan

2019-09-16 Thread Shubham Kumar
Hey everyone, Thank you for the help. @Stamatis, @Danny : Thanks for pointing out that the reltosql api should be used after volcano planner execution which considers materializations and lattices, I understand it now. @Xing: Yeah, it works perfectly fine, I am able to see simple substitutions

Re: Is it possible to retrieve materialized view query rewrite from Calcite Plan

2019-09-16 Thread XING JIN
Hi, Shubham Kumar If I understand correctly, you want get the optimized(by materialized view) SQL String. I wrote a simple test as below, please check if it's helpful for you. @Test public void testDEV() { final String m = "select \"deptno\", \"empid\", \"name\"" + "from \"emps\" where

Re: Is it possible to retrieve materialized view query rewrite from Calcite Plan

2019-09-15 Thread Danny Chan
Hi, Shubham Kumar ~ > However, I wanted the optimized rewrite SQL query if possible, not just the > plan. So far, I tried to use the rel2sql api but when I print > RelNode.toString(), it gives me a plan which involves scanning the raw > tables and hence the SQL generated by rel2sql is not the one

Re: Is it possible to retrieve materialized view query rewrite from Calcite Plan

2019-09-12 Thread Stamatis Zampetakis
Hi Shubham, View based rewriting is performed during planning (check the call hierarchy of [1] for more details). If you obtain a plan (RelNode) after the planner then most likely rel2sql API should give you the right SQL string. On the other hand if you are just using sql2rel API then rewritings

Is it possible to retrieve materialized view query rewrite from Calcite Plan

2019-09-11 Thread Shubham Kumar
Hi Contributors, I have recently started to experiment with Apache Calcite's materialized views and I needed a bit of help. I have explicitly defined materialized views which are stored in data source by defining it in root.schema.materializations of model file. Now for a query which should use