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

BigQuery Storage Write API fails with type mismatch error for DATE type #21327

Closed
damccorm opened this issue Jun 4, 2022 · 2 comments
Closed

Comments

@damccorm
Copy link
Contributor

damccorm commented Jun 4, 2022

If DATE type is specified in schema, BigQueryIO with Storage Write API may fail with the following error:

Got error com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: The proto field mismatched with BigQuery field at <table>, the proto field type string, BigQuery field type DATE Entity: <write_stream_name>
.
DATE type in BEAM for BigQuery is converted to string in proto request [1], while BigQuery Storage Write API requires an integer type for DATE type in BigQuery [2].

A workaround is to use INTEGER in BEAM and manually compute the number of days since epoch.

Actually, a feature request to BigQuery is filed at [3]. If it's implemented, we can use DATE type successfully.

[1] https://github.com/apache/beam/blob/v2.35.0/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/TableRowToStorageApiProto.java#L55-L73
[2] https://cloud.google.com/bigquery/docs/write-api#data_type_conversions
[3] https://issuetracker.google.com/issues/205174128

Imported from Jira BEAM-13753. Original Jira may contain additional context.
Reported by: baeminbo.

@ahmedabu98
Copy link
Contributor

This was fixed by #17404

@ahmedabu98
Copy link
Contributor

.close-issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants