Skip to content

Commit f24b37a

Browse files
Google APIscopybara-github
authored andcommitted
feat: add fields to eventually contain row level errors
Committer: @gnanda PiperOrigin-RevId: 456324780
1 parent c65a868 commit f24b37a

3 files changed

Lines changed: 38 additions & 7 deletions

File tree

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

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,13 @@ message CreateReadSessionRequest {
248248
// Max initial number of streams. If unset or zero, the server will
249249
// provide a value of streams so as to produce reasonable throughput. Must be
250250
// non-negative. The number of streams may be lower than the requested number,
251-
// depending on the amount parallelism that is reasonable for the table. Error
252-
// will be returned if the max count is greater than the current system
253-
// max limit of 1,000.
251+
// depending on the amount parallelism that is reasonable for the table.
252+
// There is a default system max limit of 1,000.
254253
//
255-
// Streams must be read starting from offset 0.
254+
// This must be greater than or equal to preferred_min_stream_count.
255+
// Typically, clients should either leave this unset to let the system to
256+
// determine an upper bound OR set this a size for the maximum "units of work"
257+
// it can gracefully handle.
256258
int32 max_stream_count = 3;
257259
}
258260

@@ -329,7 +331,7 @@ message ReadRowsResponse {
329331

330332
// The schema for the read. If read_options.selected_fields is set, the
331333
// schema may be different from the table schema as it will only contain
332-
// the selected fields. This schema is equivelant to the one returned by
334+
// the selected fields. This schema is equivalent to the one returned by
333335
// CreateSession. This field is only populated in the first ReadRowsResponse
334336
// RPC.
335337
oneof schema {
@@ -488,6 +490,11 @@ message AppendRowsResponse {
488490
// use it to input new type of message. It will be empty when no schema
489491
// updates have occurred.
490492
TableSchema updated_schema = 3;
493+
494+
// If a request failed due to corrupted rows, no rows in the batch will be
495+
// appended. The API will return row level error info, so that the caller can
496+
// remove the bad rows and retry the request.
497+
repeated RowError row_errors = 4;
491498
}
492499

493500
// Request message for `GetWriteStreamRequest`.
@@ -622,3 +629,24 @@ message StorageError {
622629
// Message that describes the error.
623630
string error_message = 3;
624631
}
632+
633+
// The message that presents row level error info in a request.
634+
message RowError {
635+
// Error code for `RowError`.
636+
enum RowErrorCode {
637+
// Default error.
638+
ROW_ERROR_CODE_UNSPECIFIED = 0;
639+
640+
// One or more fields in the row has errors.
641+
FIELDS_ERROR = 1;
642+
}
643+
644+
// Index of the malformed row in the request.
645+
int64 index = 1;
646+
647+
// Structured error reason for a row error.
648+
RowErrorCode code = 2;
649+
650+
// Description of the issue encountered when processing the row.
651+
string message = 3;
652+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ option php_namespace = "Google\\Cloud\\BigQuery\\Storage\\V1";
3232

3333
// Data format for input or output data.
3434
enum DataFormat {
35+
// Data format is unspecified.
3536
DATA_FORMAT_UNSPECIFIED = 0;
3637

3738
// Avro is a standard open source row based file format.
@@ -91,7 +92,7 @@ message ReadSession {
9192
// automatically assigned and currently cannot be specified or updated.
9293
google.protobuf.Timestamp expire_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
9394

94-
// Immutable. Data format of the output data.
95+
// Immutable. Data format of the output data. DATA_FORMAT_UNSPECIFIED not supported.
9596
DataFormat data_format = 3 [(google.api.field_behavior) = IMMUTABLE];
9697

9798
// The schema for the read. If read_options.selected_fields is set, the

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ option java_outer_classname = "TableProto";
2525
option java_package = "com.google.cloud.bigquery.storage.v1";
2626
option php_namespace = "Google\\Cloud\\BigQuery\\Storage\\V1";
2727

28-
// Schema of a table.
28+
// Schema of a table. This schema is a subset of
29+
// google.cloud.bigquery.v2.TableSchema containing information necessary to
30+
// generate valid message to write to BigQuery.
2931
message TableSchema {
3032
// Describes the fields in a table.
3133
repeated TableFieldSchema fields = 1;

0 commit comments

Comments
 (0)