Can you give a scenario where a RexLiteral should have a double value?

> On Jan 30, 2024, at 2:36 PM, Mihai Budiu <mbu...@gmail.com> wrote:
> 
> Hello,
> 
> I have a question about the representation of RexLiteral values.
> Currently DOUBLE-valued literals are represented using a BigDecimal.
> This causes small rounding errors, introduced in the RexBuilder.clean() 
> function.
> This causes FP expressions that are evaluated at compilation-time to produce 
> results that are slightly off from the same expressions that may be evaluated 
> at runtime, for no real reason. For example, I am running some Postgres tests 
> for FP values, and they fail because of this small difference.
> 
> I know that FP values cannot be compared for equality, and tests are supposed 
> to have some slack, but I think that this particular rounding error is not 
> necessary.
> 
> Why can't RexLiteral actually store a Double value internally when the type 
> is Double?
> Is this a bug or is there a deeper reason for this representation?
> If it's a bug I can file a JIRA issue and probably fix it.
> 
> Thank you,
> Mihai

Reply via email to