calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Re: How to use SqlStdOperatorTable.IN in RelBuilder
Date Mon, 28 Sep 2015 19:34:04 GMT
Calcite doesn’t support IN in relational expressions, only in ASTs. You’ll have to manually
rewrite to

builder.filter(
  builder.or(
    builder.equals(builder.field(“id”), builder.literal(0)),
    builder.equals(builder.field(“id”), builder.literal(2))))

We should add RelBuilder.in(RexNode seek, RexNode terms…) as syntactic sugar. I have logged
https://issues.apache.org/jira/browse/CALCITE-901 <https://issues.apache.org/jira/browse/CALCITE-901>.

Julian


> On Sep 28, 2015, at 4:28 AM, Ken <naturen@gmail.com> wrote:
> 
> Hi,
> 
> Can anyone tell me how to use the *IN* operator when building a Relation
> Node?
> 
> builder.filter(
>                builder.call(SqlStdOperatorTable.IN, builder.field("id"),
> builder.literal(0), builder.literal(2)));
> 
> I try to execute this RelNode but always got error
> message: java.lang.RuntimeException: cannot translate call IN($t0, $t6, $t8)
> 
> There are no sample test code for the IN operator. Anyway knows?
> 
> Thanks
> Ken


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message