calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dustin Freeman <jungle.free...@gmail.com>
Subject Re: Type Inference and Nullability set/change
Date Fri, 25 Oct 2019 03:19:56 GMT
Hi Danny,

Thanks very much for quick response.  Basically, you are saying that there
are not ways to change type inference rules. The only way to do that is to
write your own type inference functions for some specific calls, then use
RexShuttle to re-do type inference.

Dustin


On Thu, Oct 24, 2019 at 8:09 PM Danny Chan <yuzhao.cyz@gmail.com> wrote:

> Dustin ~
>
> The type inference for all kinds of operator/functions are defined by 2
> kinds of components in Calcite:
>
>
> • The SqlOperandTypeChecker infers the operands data types
> • The SqlReturnTypeInference infers the return data type of the call
>
> That means the type inference strategy is fixed and AFAIK, there is no way
> to change it dynamically, the strategy is registered statically with the
> function/operator.
>
> If you want to explicit specify the all the integer literals should be
> INT64(BIGINT) type, you can use a RexShuttle to visit all the rexCalls and
> rewrite your relational expression.
>
> Best,
> Danny Chan
> 在 2019年10月25日 +0800 AM10:46,Dustin Freeman <jungle.freeman@gmail.com>,写道:
> > Hi All,
> >
> > After I translate a query (SQL text) into a RelNode Tree like this,
> >
> > RelNode res = planner.getLogicalPlan(getSqlText());
> >
> > What's the simplest way to do/change type inference and set nullability
> for
> > all expressions in node res?
> >
> > It seems that RelNode has some type info already like below. It seems
> both
> > constants should have a data type int64, rather than int32. A conversion
> > there is needed. That conversion could be simplified to (const int64)1).
> > Anyways to let Calcite to do such changes?
> >
> > bool greater_than(int64 minus((int64) PID, *(const int32) 1)*, (const
> > int32) 100)
> >
> >
> > Thanks,
> >
> > Dustin
>

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