You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Ken <na...@gmail.com> on 2015/08/25 13:55:42 UTC

Using Calcite pushdown rules with MySQL

Hi all,

I'm using Calcite with MySQL as my datasource now. The thing I'm trying is
to create some rules which will modify my original sql and pushdown to
database. I followed the query over CSV example in tutorial but meet some
problem. Here are my steps:

1. My customise rule class(MysqlPushDownRules) extends the RelOptRule, and
register the rules in its constructor method. This will be matched with
incoming query and when it matches, the onMatch method in the Rule class
will be called.

2. From the tutorial, I then need to register the rules by a tablescan
class which extends  TableAccessRelBase and implement EnumberableRel, and
override the method register.

In my case of using MySQL as datasoure, where should I implement this? I'm
not sure that should I implement another table scan class for MySQL and
register my rules. Can any one have experience help me with this? Or
correct my misunderstand of using pushdown rules in Calcite.

Thanks in advance.

Ken

Re: Using Calcite pushdown rules with MySQL

Posted by Jacques Nadeau <ja...@apache.org>.
I suggest you look at the jdbc adapter. It does a bunch of this already.
On Aug 25, 2015 10:31 PM, "Ken" <na...@gmail.com> wrote:

> Hi all,
>
> I'm using Calcite with MySQL as my datasource now. The thing I'm trying is
> to create some rules which will modify my original sql and pushdown to
> database. I followed the query over CSV example in tutorial but meet some
> problem. Here are my steps:
>
> 1. My customise rule class(MysqlPushDownRules) extends the RelOptRule, and
> register the rules in its constructor method. This will be matched with
> incoming query and when it matches, the onMatch method in the Rule class
> will be called.
>
> 2. From the tutorial, I then need to register the rules by a tablescan
> class which extends  TableAccessRelBase and implement EnumberableRel, and
> override the method register.
>
> In my case of using MySQL as datasoure, where should I implement this? I'm
> not sure that should I implement another table scan class for MySQL and
> register my rules. Can any one have experience help me with this? Or
> correct my misunderstand of using pushdown rules in Calcite.
>
> Thanks in advance.
>
> Ken
>