refactor: make decimal literals actual decimals #4378
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes build failures in #4364.
Previously,
DecimalLiteral
was the only literal type where the contained java type did not reflect the literal type.DoubleLiteral
has adouble
field,StringLiteral
aString
field,IntegerLiteral
anint
field, etc. ButDecimalLiteral
contained aString
field.While this works with the legacy code for persistent and push queries, (which tend to 'toString' everything), this is actually causing issues with pull queries, which pass the result of
Literal.getValue
to theSqlValueCoercer
. The coercer will happily coerce anINT
,BIGINT
orDECIMAL
to aDOUBLE
. But it won't convert aSTRING
to aDOUBLE
. BecauseDecimalLiteral.getValue
was returning aString
the coercion failed. This issue only comes to light now that we can haveROWKEY
of typeDOUBLE
. This issue causes the following RQTT pull query test to fail:It fails with an error complaining the value
"10.1"
can not be coerced to the type ofROWKEY
, which isDOUBLE
.Switching
DecimalLiteral
to actually contain aBigDecimal
fixes this issue.Testing done
usual
Reviewer checklist