git.net

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

Re: Looking for help on query optimization statistics


Hi Tian,

To inject statistics, you need to implement your own RelMetadataProvider
and register it into your runtime environment.

I'm not able to find a valid example in Calcite, but there is a good
example you can find in Drill
https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java#L405
.


On Mon, Nov 5, 2018 at 11:54 AM Tian Ye <yet@xxxxxxxxxx> wrote:

> Hi,
>
> I'm working on comparing the query plan generated by Calcite with that
> from a DBMS I'm developing.
>
> In particular, I can generate some TPC-H data and a SQL query, and I want
> to let Calcite generate as good query plan as it can. So far, I haven't
> passed any statistics to Calcite, so the query plan it generates is just a
> baseline.
>
> Now I wonder how I could pass statistics to Calcite. What I don't
> understand is that since Calcite does not load the data until query plan is
> actually executed, how could I pass statistics to it?
> I fail to find any document talking about how to do that in detail. The
> last paragraphs of  http://calcite.apache.org/docs/adapter.html do
> mention it but are not so clear.
>
>
>
>
> Would you please help me?
>
> Thanks a lot.
>
>
>
>
> --------
> Tian Ye
> yet@xxxxxxxxxx