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

fix: doubles and floats as numerics #1648

Merged
merged 1 commit into from
Jun 7, 2022
Merged

fix: doubles and floats as numerics #1648

merged 1 commit into from
Jun 7, 2022

Conversation

dark0dave
Copy link
Contributor

@dark0dave dark0dave commented May 7, 2022

Allows floating point numbers to be numerics and big numerics.
Fixes #1516

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. size: l Pull request size is large. and removed size: m Pull request size is medium. labels May 7, 2022
@stephaniewang526 stephaniewang526 changed the title Fix/doubles and floats as numerics fix: doubles and floats as numerics May 8, 2022
@stephaniewang526
Copy link
Contributor

Hi, any update on this?

@dark0dave
Copy link
Contributor Author

yep fixing up now.

@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: l Pull request size is large. labels May 20, 2022
@dark0dave
Copy link
Contributor Author

let me fix the tests

@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels May 20, 2022
@stephaniewang526
Copy link
Contributor

any update on this?

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jun 6, 2022
@dark0dave dark0dave marked this pull request as ready for review June 6, 2022 20:10
@dark0dave dark0dave requested a review from a team June 6, 2022 20:10
@dark0dave dark0dave requested a review from a team as a code owner June 6, 2022 20:10
@dark0dave
Copy link
Contributor Author

dark0dave commented Jun 6, 2022

@stephaniewang526 apologies, been busy. Going to run tests now to see if I missed anything.

@dark0dave dark0dave changed the title fix: doubles and floats as numerics fix(floating): doubles and floats as numerics Jun 6, 2022
@dark0dave
Copy link
Contributor Author

@stephaniewang526 should be good now.

@stephaniewang526 stephaniewang526 added the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 7, 2022
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jun 7, 2022
@stephaniewang526 stephaniewang526 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 7, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 7, 2022
@stephaniewang526 stephaniewang526 changed the title fix(floating): doubles and floats as numerics fix: doubles and floats as numerics Jun 7, 2022
@stephaniewang526 stephaniewang526 merged commit ecf8598 into googleapis:main Jun 7, 2022
@feamcor
Copy link

feamcor commented Jun 14, 2022

This code new BigDecimal(((Number)val).doubleValue() is problematic as it generates an instance of BigDecimal (that is historically flawed) with a scale greater than what NUMERIC and BIGNUMERIC can cope with (9 and 38 digits specifically).

Example: A Double of value 133.36 is converted to a BigDecimal of value 133.3600000000000136424205265939235687255859375, resulting on the following exception: java.lang.IllegalArgumentException: ByteString scale cannot exceed 9: 133.3600000000000136424205265939235687255859375.

I recommend to change the code to take the Float/Double convert it to String and create the BigDecimal from the String.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BigQuery StorageWrite: JsonToProtoMessage numeric error
4 participants