Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] Rows.objectToNumber: Accept decimals with output type LONG. (#15999) #16062

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

gianm
Copy link
Contributor

@gianm gianm commented Mar 6, 2024

Backport of #15999 to 29.0.1.

…5999)

* Rows.objectToNumber: Accept decimals with output type LONG.

PR apache#15615 added an optimization to avoid parsing numbers twice in cases
where we know that they should definitely be longs or
definitely be doubles. Rather than try parsing as long first, and then
try parsing as double, it would use only the parsing routine specific to
the requested outputType.

This caused a bug: previously, we would accept decimals like "1.0" or
"1.23" as longs, by truncating them to "1". After that patch, we would
treat such decimals as nulls when the outputType is set to LONG.

This patch retains the short-circuit for doubles: if outputType is
DOUBLE, we only parse the string as a double. But for outputType LONG,
this patch restores the old behavior: try to parse as long first,
then double.
@gianm gianm added the Backport label Mar 6, 2024
@gianm gianm added this to the 29.0.1 milestone Mar 6, 2024
@abhishekagarwal87 abhishekagarwal87 merged commit 2b9ee7f into apache:29.0.1 Mar 8, 2024
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants