Hi Anton,

Following code works to me:



final RexNode shiftedDateField =

    relBuilder.call(

        SqlStdOperatorTable.TIMESTAMP_ADD,

        relBuilder.getRexBuilder().makeFlag(TimeUnitRange.MONTH),

        relBuilder.literal(1),

        relBuilder.getRexBuilder().makeDateLiteral(new DateString(2019, 1, 1))

    );





Best,
Hongze





At 2019-02-22 19:16:09, "Anton Haidai" <anton.hai...@gmail.com> wrote:
>Hello. In SQL, I can execute a query like "SELECT TIMESTAMPADD(month,
>1, "date" ) FROM ..." and it works. But my attempts to do the same
>thing using RelBuilder are not successful, for example, this code does
>not work:
>
>RexNode shiftedDateField = relBuilder.call(
>    SqlStdOperatorTable.TIMESTAMP_ADD,
>    relBuilder.literal("month"),
>    relBuilder.literal(1),
>    dateFieldRef
>);
>
>Could you please tell me, how to make a TIMESTAMP_ADD call using RelBuilder?
>-- 
>Best regards,
>Anton.

Reply via email to