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
When loading data to BigQuery with a JSON column, it fails when the actual data is a Json array [ data1, data2 ]:
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `com.google.api.services.bigquery.model.TableRow` from Array value (token `JsonToken.START_ARRAY`)
at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1]
com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1767)
com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1541)
com.fasterxml.jackson.databind.deser.std.StdDeserializer._deserializeFromArray(StdDeserializer.java:222)
com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:457)
com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:32)
com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:342)
com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4917)
com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3860)
com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3828)
com.spotify.scio.bigquery.types.package$Json$.parse(package.scala:76)
@BigQueryType.toTable <== line where there is the toTable annotation
It did work with JacksonNode, but I wonder if it is possible with TableRow.
The text was updated successfully, but these errors were encountered:
Looking after it, now I remember why I came up with JacksonNode.
Beam is using a unmaintained BigQuery client. I could not find anything in it dealing with JSON fields, so I supposed it to be directly stored as a simple JSON element in its representation tree.
Also BigQuery doc states:
BigQuery supports the JSON type even if schema information is not known at the time of ingestion. A field that is declared as JSON type is loaded with the raw JSON values.
Thing is, google-api-services-bigquery relies on google-http-client JsonFactory, which is backed by either Jackson or Gson. I tried JacksonNode and worked like a charm.
I don't know what was the issue with it, but maybe a Gson JsonElement can do instead?
When loading data to BigQuery with a JSON column, it fails when the actual data is a Json array
[ data1, data2 ]
:It did work with
JacksonNode
, but I wonder if it is possible withTableRow
.The text was updated successfully, but these errors were encountered: