Re: Mapping arithmetic '+' operator with Date and Timestamp operands to target dialect functions

2019-08-27 Thread Julian Hyde
I like the idea of transforming the Rex/Rel tree for the target dialect. Via a RelOptRule or other means. Or perhaps transform the SqlNode tree (which is how we deal with ORDER BY ... NULLS LAST). That’s better, in general, than making the SqlNode-to-string logic more and more complex,

Mapping arithmetic '+' operator with Date and Timestamp operands to target dialect functions

2019-08-26 Thread Sachin Rohaj
Hello Xing, No I will not be maintaining a customized `SqlImplementor`, rather I'll be making changes in the existing `SqlImplementor`. Regards, Sachin

Re: Mapping arithmetic '+' operator with Date and Timestamp operands to target dialect functions

2019-08-26 Thread XING JIN
I guess in your approach, you need to maintain a customized `SqlImplementor` ? How about add a RelOptRule and detect pattern of "date + interval '1' DAY" and use a RexShuttle to convert to "target_func(date, interval '1' DAY)" Thus only a RelOptRule needs to be maintained. Sachin Rohaj

Mapping arithmetic '+' operator with Date and Timestamp operands to target dialect functions

2019-08-23 Thread Sachin Rohaj
Hello, In one of my use case i am working on DATE and TIMESTAMP based operands. We have select date + interval '1' DAY from table; I need to map this to target dialect. select target_func(date, interval '1' DAY) from table; *Approach*: I am planning to intercept the '+' operator in the