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

[Bug]: Cannot use Json type with BigQueryIO and write method FILE_LOAD, avro #23025

Closed
takaaki7 opened this issue Sep 3, 2022 · 2 comments · Fixed by #29923
Closed

[Bug]: Cannot use Json type with BigQueryIO and write method FILE_LOAD, avro #23025

takaaki7 opened this issue Sep 3, 2022 · 2 comments · Fixed by #29923

Comments

@takaaki7
Copy link

takaaki7 commented Sep 3, 2022

What happened?

BigQueryIO document says FILE_LOAD not support JSON type.
https://github.com/apache/beam/blob/master/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java#L1841

And when specifying schema to use avro, validation logic causes error.

But currently, It seems JSON type works well with load api.

I think now we can remove this validation and modify document.

Issue Priority

Priority: 3

Issue Component

Component: extensions-java-gcp

@Abacn
Copy link
Contributor

Abacn commented Jan 4, 2024

I tried to remove the validation and use run BigQueryIOJsonIT. There is a caveat that for a TableRow, if I set it to be

.set("country_code", some_json_of_string_type) // some_json_of_string_type = "{\"a\":\"b\"}"

The written json is a single escaped string ( "{"a":"b"}" ) using FILE_LOAD method. But the string is unescaped using STORAGE_WRITE_API or STREAMING_INSERT method ( {"a":"b"} ).

@Abacn
Copy link
Contributor

Abacn commented Jan 4, 2024

Checked that this feature was added in late 2022 (internal tracker cl/457809718). So it is safe to lift this checkArgument. Opened #29923

@github-actions github-actions bot added this to the 2.55.0 Release milestone Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants