Skip to content

Timestamp still not parsed correctly #1579

@dark0dave

Description

@dark0dave

Environment details

  1. BigQuery storage API JSONToProtoMessage
  2. OS type and version: Linux/Any
  3. Java version: 11
  4. version(s): Most recent v2.11.0

Steps to reproduce

Create a string field in a JSONObject with schema Timestamp, value something reasonable: "2022-02-06 07:24:47.84".

Returns 1970-01-20 00:42:12.287840 UTC (In bigquery which is not correct)

  1. Create a bigquery table with only one field of type TIMESTAMP and with name "d"
  2. Use JsonStreamWriter with this JSON Array [{"d":"2022-02-06 07:24:47.84"}] d will be encoded into big query incorrectly.
  3. Run

Linked to #1515

Code:

    final var tableSchema =
        TableSchema.newBuilder()
            .addFields(
                TableFieldSchema.newBuilder()
                    .setType(TIMESTAMP)
                    .setName("d")
                    .setMode(NULLABLE)
                    .build())
            .build();

Rest of code is identical to your sample in https://github.com/googleapis/java-bigquerystorage/blob/main/samples/snippets/src/main/java/com/example/bigquerystorage/WriteCommittedStream.java except for the fact that the data is just [{"d":"2022-02-06 07:24:47.84"}]

Metadata

Metadata

Labels

api: bigquerystorageIssues related to the googleapis/java-bigquerystorage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions