-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
bigquery: big.Rat limited to 9 digits #4704
Comments
Some background: The underlying issue here is the big.Rat doesn't report the value's precision or scale, so we have to pick the most appropriate type. And for compatibility sake, we continue to infer the NUMERIC type, as to do otherwise might break existing Much like |
Something like golang/go#47911 would help with this I think? Or maybe something like Also see #4703 (comment). |
Alvaro, mind taking a look at this one? I suspect the resolution here (and in some related issues) is to do the work to enable explicit query parameter construction. There are multiple cases where we have ambiguous type conversions, so the goal would be to allow users to construct a query parameter explicitly, rather than the current behavior which infers everything from the Go type. A source of potential complexity here is complex types (e.g. struct types), which are completely valid for query parameters. The interesting questions are whether we allow any type inferencing of the leaf types, or whether everything must be explicit etc. |
Allow users to pass query parameter with an explicit data types instead of relying just on type inference. Resolves #4704
Thanks @alvarowolfx! |
🤖 I have created a release *beep* *boop* --- ## [1.42.0](bigquery/v1.41.0...bigquery/v1.42.0) (2022-09-21) ### Features * **bigquery/analyticshub:** Start generating apiv1 ([#6707](#6707)) ([feb7d7d](feb7d7d)) * **bigquery/datapolicies:** Start generating apiv1beta1 ([#6697](#6697)) ([f5443e8](f5443e8)) * **bigquery/reservation/apiv1beta1:** add REST transport ([f7b0822](f7b0822)) * **bigquery/storage/managedwriter:** Define append retry predicate ([#6650](#6650)) ([478b8dd](478b8dd)) * **bigquery/storage:** add proto annotation for non-ascii field mapping ([ec1a190](ec1a190)) * **bigquery:** Add reference file schema option for federated formats ([#6693](#6693)) ([3d26091](3d26091)) * **bigquery:** Add support for explicit query parameter type ([#6596](#6596)) ([d59b5b2](d59b5b2)), refs [#4704](#4704) ### Bug Fixes * **bigquery/connection:** integrate gapic-generator-python-1.4.1 and enable more py_test targets ([ec1a190](ec1a190)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Client
BigQuery
Environment
N/A
Go Environment
Code
https://pkg.go.dev/cloud.google.com/go/bigquery#InferSchema documents that
big.Rat
types are limited to 9 digits after then decimal, this also seems to be the case for parameters to query. However BigQuery supports much more precision (up to 76, https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#numeric-type). It would be nice to able to query using these high precision numbers.I guess that the parameters are send as strings so you have to make a decision, but could the limit be increased? Alternatively can we send our own string (with our own defined precision) as number?
Also related: golang/go#47911: Support precision of -1 in Rat.FloatString (that will use the required number of digits to represent the number).
Expected behavior
I expected large precision numbers to be support.
Actual behavior
Large numbers are limited to 9 digits after the decimal.
The text was updated successfully, but these errors were encountered: