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
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
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
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
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