Thanks for reporting this Hrudaya ~ I think the type inference of BETWEEN operator should be fixed, just like the CASE operator [1], would fire a fix soon ~
[1] https://github.com/apache/calcite/blob/44be09dff80768be39784d3bff596d5f6727273d/core/src/main/java/org/apache/calcite/sql/fun/SqlCaseOperator.java#L221 Best, Danny Chan 在 2020年1月18日 +0800 AM9:56,Hrudaya Reddy <[email protected]>,写道: > Hi all, > > We are trying to generate the following sql query > > SELECT [user_id], [create_date] > FROM [users] > WHERE [user_id] BETWEEN 1 AND 5 > > I am trying the following but I get ClassCastException error > > RexNode betweenCondition = relBuilder.call(SqlStdOperatorTable.BETWEEN, > relBuilder.field("user_id"), > relBuilder.literal(1), relBuilder.literal(5)); > > Exception in thread "main" java.lang.ClassCastException: > org.apache.calcite.rex.RexCallBinding cannot be cast to > org.apache.calcite.sql.SqlCallBinding > at > org.apache.calcite.sql.fun.SqlBetweenOperator.inferReturnType(SqlBetweenOperator.java:139) > at org.apache.calcite.rex.RexBuilder.deriveReturnType(RexBuilder.java:276) > at org.apache.calcite.tools.RelBuilder.call(RelBuilder.java:602) > at org.apache.calcite.tools.RelBuilder.call(RelBuilder.java:596) > > I would really appreciate it if you could guide me with the correct usage of > the BETWEEN operator. > > Thanks in advance. > > Regards, > Hrudaya > > This message, together with any attachments, is intended only for the use of > the individual or entity to which it is addressed and may contain > confidential and/or privileged information. If you are not the intended > recipient(s), or the employee or agent responsible for delivery of this > message to the intended recipient(s), you are hereby notified that any > dissemination, distribution or copying of this message, or any attachment, is > strictly prohibited. If you have received this message in error, please > immediately notify the sender and delete the message, together with any > attachments, from your computer. Thank you for your cooperation.
