googleapis / java-bigquerystorage

Apache License 2.0
60 stars 83 forks source link

BigQuery Storage Write API: JsonStreamWriter doesn't support _CHANGE_TYPE pseudocolumn #2768

Closed Idane closed 7 hours ago

Idane commented 7 hours ago

Environment details

  1. OS type and version: MacOS
  2. Java version: 17
  3. version(s): 3.9.3

Steps to reproduce

  1. Attempt to pass _CHANGE_TYPE value on your JSONRecord

Code example

Full code example: https://cloud.google.com/bigquery/docs/write-api-streaming

    JSONObject record = new JSONObject();
    record.put("id", String.valueOf(j));
    record.put("name", "example");
    record.put("_CHANGE_TYPE", "UPSERT");

Stack trace

Saw unknown field error during proto message conversin within error messages{0=The source object has fields unknown to BigQuery: root._CHANGE_TYPE., 1=The source object has fields unknown to BigQuery: root

External references such as API reference guides

Any additional information below

Using the normal StreamWriter with a proto payload works for this.

Idane commented 7 hours ago

Saw this, closing! https://github.com/googleapis/java-bigquerystorage/blob/main/samples/snippets/src/main/java/com/example/bigquerystorage/JsonWriterStreamCdc.java