From 43bf96fa41b19ed90790e157a0d0d22ecd20c0d8 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Tue, 15 Nov 2022 10:20:43 -0800 Subject: [PATCH] feat: add missing_value_interpretations to AppendRowsRequest PiperOrigin-RevId: 488693558 --- .../cloud/bigquery/storage/v1/storage.proto | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/google/cloud/bigquery/storage/v1/storage.proto b/google/cloud/bigquery/storage/v1/storage.proto index df602135b9d80..b01ed271ae91b 100644 --- a/google/cloud/bigquery/storage/v1/storage.proto +++ b/google/cloud/bigquery/storage/v1/storage.proto @@ -417,6 +417,23 @@ message AppendRowsRequest { ProtoRows rows = 2; } + // An enum to indicate how to interpret missing values. Missing values are + // fields present in user schema but missing in rows. A missing value can + // represent a NULL or a column default value defined in BigQuery table + // schema. + enum MissingValueInterpretation { + // Invalid missing value interpretation. Requests with this value will be + // rejected. + MISSING_VALUE_INTERPRETATION_UNSPECIFIED = 0; + + // Missing value is interpreted as NULL. + NULL_VALUE = 1; + + // Missing value is interpreted as column default value if declared in the + // table schema, NULL otherwise. + DEFAULT_VALUE = 2; + } + // Required. The write_stream identifies the target of the append operation, and only // needs to be specified as part of the first request on the gRPC connection. // If provided for subsequent requests, it must match the value of the first @@ -454,6 +471,26 @@ message AppendRowsRequest { // Id set by client to annotate its identity. Only initial request setting is // respected. string trace_id = 6; + + // A map to indicate how to interpret missing value for some fields. Missing + // values are fields present in user schema but missing in rows. The key is + // the field name. The value is the interpretation of missing values for the + // field. + // + // For example, a map {'foo': NULL_VALUE, 'bar': DEFAULT_VALUE} means all + // missing values in field foo are interpreted as NULL, all missing values in + // field bar are interpreted as the default value of field bar in table + // schema. + // + // If a field is not in this map and has missing values, the missing values + // in this field are interpreted as NULL. + // + // This field only applies to the current request, it won't affect other + // requests on the connection. + // + // Currently, field name can only be top-level column name, can't be a struct + // field path like 'foo.bar'. + map missing_value_interpretations = 7; } // Response message for `AppendRows`.