As the java doc says, RexLiteral.getValue2 returns values in the form that the 
calculator builder needs them. That may not be the form that you need them. In 
which case, don’t use that method.

If you want a Double, have you tried literal.getValueAs(Double.class)?

(We don’t tend to use Float and Double much because when we’re compiling 
queries we can’t afford any loss of precision. If the user typed 1.1 we want 
exactly 1.1, whereas Decimal might be something like 1.000000000987.)

> On Mar 4, 2020, at 9:43 PM, Xiangwei Wei <[email protected]> wrote:
> 
> In RexLiteral.getValue2(), it treats Decimal just by `return
> getValueAs(Long.class);`.
> In this instance, we can't get a correct double/float value because it's
> considered as Decimal type here. Is this a problem or is there a reason
> here?
> 
> -- 
> Best,
> Xiangwei Wei

Reply via email to