Hi Dustin,

The other alternative would be to pass your own SqlRexConvertletTable when
you create the SqlToRelConverter [2].

Best,
Stamatis

[2]
https://github.com/apache/calcite/blob/4d1c3e54fc4172c7ff00db3326823c42f237cf04/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L311

On Sun, Nov 10, 2019 at 4:27 AM Dustin Freeman <[email protected]>
wrote:

> Thanks Danny,
>
> Dustin
>
>
> On Sat, Nov 9, 2019 at 6:54 PM Danny Chan <[email protected]> wrote:
>
> > Dear Dustin ~
> >
> > The
> > TIMESTAMPADD(unit, count, timestamp) => timestamp + count * INTERVAL ‘1’
> > UNIT [1]
> > conversion happens atomically during the sql-to-rel phrase, and there is
> > no way to “stop” the rewrite by config.
> >
> > There is a hack way to implement this, you can overwrite the
> > SqlTimestampAddFunction#rewriteCall and implement an operator of your
> own,
> > but then you should translate the operator by your self.
> >
> > [1]
> >
> https://github.com/apache/calcite/blob/4d1c3e54fc4172c7ff00db3326823c42f237cf04/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java#L1443
> >
> > Best,
> > Danny Chan
> > 在 2019年11月10日 +0800 AM8:30,Dustin Freeman <[email protected]>,写道:
> > > Hi,
> > >
> > > It seems that Calcite rewrites TimestampAdd(x, 100) to following
> > expression
> > > [+($3, *(12:INTERVAL YEAR, 100))]
> > >
> > > Can anyone tell me how to stop above rewrite?
> > >
> > > Thanks,
> > >
> > > Dustin
> >
>

Reply via email to