osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Query] Can we use calcite for rewriting the query based on Materialized View


Hi Kumar,

Yes, it is possible.

As long as you have your schema defined you can create a Planner (Volcano,
or Heuristic) with the appropriate rules for view based rewritting and
obtain a plan that is using the views. Then you can pass from a plan back
to sql using RelToSqlConverter.

You might find interesting the discussion in [1]. You can also have a look
in the MaterializationTest which can serve as an entry point in order to
understand how the rewritting works.

Best,
Stamatis

[1]
http://mail-archives.apache.org/mod_mbox/calcite-dev/201810.mbox/%3CAM0PR07MB5185C3F75488AA768815CF4FCCFD0%40AM0PR07MB5185.eurprd07.prod.outlook.com%3E

Στις Παρ, 7 Δεκ 2018 στις 5:15 μ.μ., ο/η Kumar Vishal <
kumarvishal1802@xxxxxxxxx> έγραψε:

> Hi Dev,
>
> I am a new bee and analysing Calcite Materialized View. In my scenario I
> have multiple execution engines which have their own parser and
> optimizer(Some do not have integration with calcite). I want to register
> all the tables and Materialized Views to Calcite and handle commonly for
> all execution engines.
>
> i.e. I want to redirect User queries to calcite and get back the rewritten
> sql (by selecting best fit Materialized View), so rewritten sql can be
> executed by execution engine.
>
> Is there anyway to get the rewritten sql based on Materialized View??
>
> -Regards
> Kumar Vishal
>