Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support For Proto Column in Spanner #1829

Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"ycsb": "node ./benchmark/ycsb.js run -P ./benchmark/workloada -p table=usertable -p cloudspanner.instance=ycsb-instance -p operationcount=100 -p cloudspanner.database=ycsb",
"fix": "gts fix",
"clean": "gts clean",
"compile": "tsc -p . && cp -r protos build",
"compile": "tsc -p . && cp -r protos build && cp -r test/data build/test",
"prepare": "npm run compile-protos && npm run compile",
"pretest": "npm run compile",
"presystem-test": "npm run compile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,26 @@ message CreateDatabaseRequest {

// Optional. The dialect of the Cloud Spanner Database.
DatabaseDialect database_dialect = 5 [(google.api.field_behavior) = OPTIONAL];

// Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
// 'extra_statements' above.
// Contains a protobuf-serialized
// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
// To generate it, [install](https://grpc.io/docs/protoc-installation/) and
// run `protoc` with --include_imports and --descriptor_set_out. For example,
// to generate for moon/shot/app.proto, run
// """
// $protoc --proto_path=/app_path --proto_path=/lib_path \
// --include_imports \
// --descriptor_set_out=descriptors.data \
// moon/shot/app.proto
// """
// For more details, see protobuffer [self
// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
// (--
// TODO(b/236424835) remove visibility check before launch.
// --)
bytes proto_descriptors = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Metadata type for the operation returned by
Expand Down Expand Up @@ -585,6 +605,26 @@ message UpdateDatabaseDdlRequest {
// [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns
// `ALREADY_EXISTS`.
string operation_id = 3;

// Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
// 'extra_statements' above.
// Contains a protobuf-serialized
// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
// To generate it, [install](https://grpc.io/docs/protoc-installation/) and
// run `protoc` with --include_imports and --descriptor_set_out. For example,
// to generate for moon/shot/app.proto, run
// """
// $protoc --proto_path=/app_path --proto_path=/lib_path \
// --include_imports \
// --descriptor_set_out=descriptors.data \
// moon/shot/app.proto
// """
// For more details, see protobuffer [self
// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
// (--
// TODO(b/236424835) remove visibility check before launch.
// --)
bytes proto_descriptors = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Metadata type for the operation returned by
Expand Down Expand Up @@ -649,6 +689,16 @@ message GetDatabaseDdlResponse {
// A list of formatted DDL statements defining the schema of the database
// specified in the request.
repeated string statements = 1;

// Proto descriptors stored in the database.
// Contains a protobuf-serialized
// [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
// For more details, see protobuffer [self
// description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
// (--
// TODO(b/236424835) remove visibility check before launch.
// --)
bytes proto_descriptors = 2;
}

// The request for
Expand Down
12 changes: 12 additions & 0 deletions protos/google/spanner/v1/type.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ message Type {
// typically is not needed to process the content of a value (it doesn't
// affect serialization) and clients can ignore it on the read path.
TypeAnnotationCode type_annotation = 4;

// If [code][] == [PROTO][TypeCode.PROTO] or [code][] ==
// [ENUM][TypeCode.ENUM], then `proto_type_fqn` is the fully qualified name of
// the proto type representing the proto/enum definition.
string proto_type_fqn = 5;
}

// `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type.
Expand Down Expand Up @@ -145,6 +150,13 @@ enum TypeCode {
// preserved.
// - JSON array elements will have their order preserved.
JSON = 11;

// Encoded as a base64-encoded `string`, as described in RFC 4648,
// section 4.
PROTO = 13;

// Encoded as `string`, in decimal format.
ENUM = 14;
}

// `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to
Expand Down
28 changes: 27 additions & 1 deletion protos/protos.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading