Skip to content

Commit e12436a

Browse files
authored
Merge pull request #37376: Adds a new SchemaCoderPayload proto to use for portable SchemaCoders.
2 parents f8013e6 + e4a5eea commit e12436a

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,10 @@ message StandardCoders {
10731073
// Components: None
10741074
ROW = 13 [(beam_urn) = "beam:coder:row:v1"];
10751075

1076+
// Similar to ROW above, but for arbitrary types that can be converted
1077+
// to and from row objects, which can then be encoded with a schema.
1078+
SCHEMA = 18 [(beam_urn) = "beam:coder:schema:v1"];
1079+
10761080
// Encodes a user key and a shard id which is an opaque byte string.
10771081
//
10781082
// The encoding for a sharded key consists of a shard id byte string and the

model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/schema.proto

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ message Field {
4848
// OPTIONAL. Human readable description of this field, such as the query that generated it.
4949
string description = 2;
5050
FieldType type = 3;
51-
51+
5252
int32 id = 4;
5353
// OPTIONAL. The position of this field's data when encoded, e.g. with beam:coder:row:v1.
5454
// Either no fields in a given row are have encoding position populated,
@@ -237,3 +237,23 @@ message MapTypeEntry {
237237
message LogicalTypeValue {
238238
FieldValue value = 1;
239239
}
240+
241+
// Information needed to represent a Coder of type SCHEMA.
242+
message SchemaCoderPayload {
243+
// The schema to use for encoding corresponding Row types.
244+
Schema schema = 1;
245+
246+
// Function mapping from underlying object to Row type.
247+
FunctionSpec to_row_fn = 2;
248+
249+
// Function mapping from Row type to underlying object.
250+
FunctionSpec from_row_fn = 3;
251+
252+
// Any additional information SDKs need to encode/decode elements.
253+
repeated AdditionalCoderInfo additional_coder_infos = 4;
254+
255+
message AdditionalCoderInfo {
256+
string urn = 1;
257+
bytes payload = 2;
258+
}
259+
}

0 commit comments

Comments
 (0)