apache / apache/beam

BigQueryUtils DATETIME conversion requires unix millis

Open
#20,243 0 comments 0 reactions 0 assignees View on GitHub
bug core java P3
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

I'm trying to run a very simple GCP Dataflow SQL job (copy all columns from table A to B), and it's failing with the following exception:
```

Caused by: java.lang.ClassCastException: org.apache.avro.util.Utf8 cannot be cast to java.lang.Longat org.apache.beam.sdk.io.gcp.bigquery.BigQueryUtils.truncateToMillis (BigQueryUtils.java:643)at org.apache.beam.sdk.io.gcp.bigquery.BigQueryUtils.convertAvroFormat (BigQueryUtils.java:597)at org.apache.beam.sdk.io.gcp.bigquery.BigQueryUtils.lambda$toBeamRow$5 (BigQueryUtils.java:389)

```

It looks to me like this is because BigQueryUtils.convertAvroFormat expects that any value whose (beam) type is "DATETIME" must be expressed in unix millis. However, these values come out of BigQuery as a string, (AFAICT) in ISO 8601 format.

Imported from Jira [BEAM-10021](https://issues.apache.org/jira/browse/BEAM-10021). Original Jira may contain additional context.
Reported by: benbirt.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.