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 <jungle.free...@gmail.com>,写道:
> 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