You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a bigquery table with only one field of type NUMERIC and with name "d"
Use JsonStreamWriter with this JSON Array [{"d":1}]
run
Stack trace
java.lang.IllegalArgumentException: JSONObject does not have a bytes field at root.d.
at com.google.cloud.bigquery.storage.v1.JsonToProtoMessage.fillField(JsonToProtoMessage.java:351)
at com.google.cloud.bigquery.storage.v1.JsonToProtoMessage.convertJsonToProtoMessageImpl(JsonToProtoMessage.java:176)
at com.google.cloud.bigquery.storage.v1.JsonToProtoMessage.convertJsonToProtoMessage(JsonToProtoMessage.java:115)
at com.google.cloud.bigquery.storage.v1.JsonStreamWriter.append(JsonStreamWriter.java:140)
at com.google.cloud.bigquery.storage.v1.JsonStreamWriter.append(JsonStreamWriter.java:99)
at persistence.BigqueryStreamingClient.streamJsonArray(BigqueryStreamingClient.java:80)
External references such as API reference guides
?
Any additional information below
It seems if you try to write an int/long to a NUMERIC field, it fails because the proto converter requires a bytes object for NUMERIC's. Looking at
it looks like only Strings or ByteStrings are converted to bytes. The end result is not being able to write numeric java types to the NUMERIC BQ column.
Environment details
Steps to reproduce
[{"d":1}]Stack trace
External references such as API reference guides
Any additional information below
It seems if you try to write an int/long to a NUMERIC field, it fails because the proto converter requires a bytes object for NUMERIC's. Looking at
java-bigquerystorage/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/JsonToProtoMessage.java
Line 229 in 4c532b0