Yes, all non-floating point numeric literals will have SqlTypeName of DECIMAL 
when created using RexBuilder.makeLiteral. It is trying to achieve the same 
affect as if the user wrote “1” in SQL.

If you need it to be an INTEGER, you should call RexBuilder.makeCast on the 
result.
 

> On Jun 13, 2017, at 8:25 AM, James <[email protected]> wrote:
> 
> Hi all,
> 
> I want to make an integer literal to feed to the string POSITION
> function(POSITION(string1 IN string2)) for unittesting, but I can't find
> the right function to do this. The best try I ever had is:
> 
>    rexBuilder.makeLiteral(1,
> typeFactory.createSqlType(SqlTypeName.INTEGER), false)
> 
> But it returns a DECIMAL literal.
> 
> My question is: is it possible to make an integer literal using RexBuilder?
> If yes, then how? If not, then what's the reason?
> 
> Thanks in advance.
> James

Reply via email to