Skip to content

Commit 43bf96f

Browse files
Google APIscopybara-github
authored andcommitted
feat: add missing_value_interpretations to AppendRowsRequest
PiperOrigin-RevId: 488693558
1 parent d1e4539 commit 43bf96f

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

google/cloud/bigquery/storage/v1/storage.proto

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,23 @@ message AppendRowsRequest {
417417
ProtoRows rows = 2;
418418
}
419419

420+
// An enum to indicate how to interpret missing values. Missing values are
421+
// fields present in user schema but missing in rows. A missing value can
422+
// represent a NULL or a column default value defined in BigQuery table
423+
// schema.
424+
enum MissingValueInterpretation {
425+
// Invalid missing value interpretation. Requests with this value will be
426+
// rejected.
427+
MISSING_VALUE_INTERPRETATION_UNSPECIFIED = 0;
428+
429+
// Missing value is interpreted as NULL.
430+
NULL_VALUE = 1;
431+
432+
// Missing value is interpreted as column default value if declared in the
433+
// table schema, NULL otherwise.
434+
DEFAULT_VALUE = 2;
435+
}
436+
420437
// Required. The write_stream identifies the target of the append operation, and only
421438
// needs to be specified as part of the first request on the gRPC connection.
422439
// If provided for subsequent requests, it must match the value of the first
@@ -454,6 +471,26 @@ message AppendRowsRequest {
454471
// Id set by client to annotate its identity. Only initial request setting is
455472
// respected.
456473
string trace_id = 6;
474+
475+
// A map to indicate how to interpret missing value for some fields. Missing
476+
// values are fields present in user schema but missing in rows. The key is
477+
// the field name. The value is the interpretation of missing values for the
478+
// field.
479+
//
480+
// For example, a map {'foo': NULL_VALUE, 'bar': DEFAULT_VALUE} means all
481+
// missing values in field foo are interpreted as NULL, all missing values in
482+
// field bar are interpreted as the default value of field bar in table
483+
// schema.
484+
//
485+
// If a field is not in this map and has missing values, the missing values
486+
// in this field are interpreted as NULL.
487+
//
488+
// This field only applies to the current request, it won't affect other
489+
// requests on the connection.
490+
//
491+
// Currently, field name can only be top-level column name, can't be a struct
492+
// field path like 'foo.bar'.
493+
map<string, MissingValueInterpretation> missing_value_interpretations = 7;
457494
}
458495

459496
// Response message for `AppendRows`.

0 commit comments

Comments
 (0)