Client
cloud.google.com/go/bigquery@v1.60.0
Environment
doesn't matter here
Go Environment
Go 1.22
Scenario/How to reproduce
- Create a table with at least one numeric column.
- Execute SQL
set options(rounding_mode = "ROUND_HALF_EVEN") on numeric column
- Numeric column shows
ROUND_HALF_EVEN in INFORMATION_SCHEMA.COLUMNS.rounding_mode field
- Use standard code example that adds another column (as per below link)
- Numeric column's value in
INFORMATION_SCHEMA.COLUMNS.rounding_mode field is now empty
Code
Identical to standard example:
https://github.com/GoogleCloudPlatform/golang-samples/blob/bdc987b4624a0939603bb9f0a74eb2b815aa6577/bigquery/snippets/table/bigquery_add_empty_column.go#L26
Expected behavior
New fields are added.
Existing fields are obviously unchanged including their options like rounding_mode.
P.S. My guess is that the cause is due to the fact that while Google API's TableFieldSchema contains roundingMode field (https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#tablefieldschema), the Go client's FieldSchema object doesn't not, thus the value is lost already during toBQ() call during getting Table/Metadata
(
|
func (fs *FieldSchema) toBQ() *bq.TableFieldSchema { |
).
Then when code executes table update/patch with previously retrieved Table/Metadata, the underlying Google API call will always have empty roundingMode json param for all fields.
The description column option, on the other side, works fine, because it is reflected in FieldSchema object
Client
cloud.google.com/go/bigquery@v1.60.0
Environment
doesn't matter here
Go Environment
Go 1.22
Scenario/How to reproduce
set options(rounding_mode = "ROUND_HALF_EVEN")on numeric columnROUND_HALF_EVENinINFORMATION_SCHEMA.COLUMNS.rounding_modefieldINFORMATION_SCHEMA.COLUMNS.rounding_modefield is now emptyCode
Identical to standard example:
https://github.com/GoogleCloudPlatform/golang-samples/blob/bdc987b4624a0939603bb9f0a74eb2b815aa6577/bigquery/snippets/table/bigquery_add_empty_column.go#L26
Expected behavior
New fields are added.
Existing fields are obviously unchanged including their options like rounding_mode.
P.S. My guess is that the cause is due to the fact that while Google API's TableFieldSchema contains roundingMode field (https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#tablefieldschema), the Go client's FieldSchema object doesn't not, thus the value is lost already during toBQ() call during getting Table/Metadata
(
google-cloud-go/bigquery/schema.go
Line 157 in c15d69a
Then when code executes table update/patch with previously retrieved Table/Metadata, the underlying Google API call will always have empty roundingMode json param for all fields.
The
descriptioncolumn option, on the other side, works fine, because it is reflected in FieldSchema object