You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Rakesh Nair <ra...@6dtech.co.in> on 2019/03/14 11:56:43 UTC

Parantheses in RelBuilder?

Hello,
Would you mind giving me some pointers on *creating parenthesis while
building a RelNode*.
For example, how to build RelNode for the sample query:
SELECT * FROM `persons` WHERE *(*`SALARY` >= 10 AND `SALARY` < 20*)  *OR
*(*`SALARY` >= 30 AND `SALARY` < 40*)*

P.S. Need to know how to build the parenthesis only, everything else is
fine..
-- 
Thanks & Regards,
Rakesh

Re: Parantheses in RelBuilder?

Posted by Michael Mior <mm...@apache.org>.
You don't explicitly create parenthesis. You just need to construct
the conditions in the right order. Just construct the two parts of
your OR separately and then create a new RexCall node with the OR
operator where you pass in each of the two RexNodes you want to
compare.
--
Michael Mior
mmior@apache.org

Le jeu. 14 mars 2019 à 07:56, Rakesh Nair <ra...@6dtech.co.in> a écrit :
>
> Hello,
> Would you mind giving me some pointers on *creating parenthesis while
> building a RelNode*.
> For example, how to build RelNode for the sample query:
> SELECT * FROM `persons` WHERE *(*`SALARY` >= 10 AND `SALARY` < 20*)  *OR
> *(*`SALARY` >= 30 AND `SALARY` < 40*)*
>
> P.S. Need to know how to build the parenthesis only, everything else is
> fine..
> --
> Thanks & Regards,
> Rakesh

Re: Parantheses in RelBuilder?

Posted by Yuzhao Chen <yu...@gmail.com>.
Hi, Rakesh Nair.
RelBuilder/RexBuilder are used to construct rel/rex nodes, but parenthesis are not, parenthesis only defines the scope and precedence of the relational algebra. You only need to construct the rel/rex nodes directly with the defined precedence by parenthesis.

Best,
Danny Chan
在 2019年3月14日 +0800 PM7:56,Rakesh Nair <ra...@6dtech.co.in>,写道:
> Hello,
> Would you mind giving me some pointers on *creating parenthesis while
> building a RelNode*.
> For example, how to build RelNode for the sample query:
> SELECT * FROM `persons` WHERE *(*`SALARY` >= 10 AND `SALARY` < 20*) *OR
> *(*`SALARY` >= 30 AND `SALARY` < 40*)*
>
> P.S. Need to know how to build the parenthesis only, everything else is
> fine..
> --
> Thanks & Regards,
> Rakesh