Skip to content

Commit 1fe9551

Browse files
committed
Document pipeline runner API protos
Add documentation comments to previously undocumented messages and fields in the Beam Runner API pipeline model protos: beam_runner_api.proto: State specs (ReadModifyWrite, Bag, Combining, Map, Multimap, Set, TimerFamily), environment payloads (Docker, Process, External, AnyOf), artifact messages, triggers, RedistributePayload, IsBounded, LabelledPayload, and more. metrics.proto: MonitoringInfo, MonitoringInfoSpecs, labels, type URNs. schema.proto: Schema, Field, FieldType, all type variants, Row, FieldValue. external_transforms.proto: ManagedTransforms, Annotations. endpoints.proto: AuthenticationSpec.
1 parent 01b0972 commit 1fe9551

5 files changed

Lines changed: 269 additions & 15 deletions

File tree

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

Lines changed: 84 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -586,11 +586,17 @@ message StateSpec {
586586
FunctionSpec protocol = 7;
587587
}
588588

589+
// Specification for a read-modify-write state cell, which holds a single value
590+
// per key and window. The value can be read, modified, and written back atomically.
589591
message ReadModifyWriteStateSpec {
592+
// (Required) The id of the Coder for the values stored in this state cell.
590593
string coder_id = 1;
591594
}
592595

596+
// Specification for a bag state cell, which holds an unordered collection of elements
597+
// per key and window. Elements can be appended and read as an iterable.
593598
message BagStateSpec {
599+
// (Required) The id of the Coder for elements stored in this bag.
594600
string element_coder_id = 1;
595601
}
596602

@@ -601,30 +607,57 @@ message OrderedListStateSpec {
601607
string element_coder_id = 1;
602608
}
603609

610+
// Specification for a combining state cell, which incrementally combines values
611+
// using a CombineFn. Rather than storing all input values, it stores a single
612+
// accumulator that is updated as new values arrive.
604613
message CombiningStateSpec {
614+
// (Required) The id of the Coder for the accumulator.
605615
string accumulator_coder_id = 1;
616+
// (Required) The FunctionSpec of the CombineFn used to combine values.
606617
FunctionSpec combine_fn = 2;
607618
}
608619

620+
// Specification for a map state cell, which holds a key-value mapping per key
621+
// and window. Keys and values can be read, written, and deleted individually.
622+
// Note: This is distinct from MultimapStateSpec in that MapState keys are unique.
623+
// In practice, Beam SDKs use Multimap state for both map and multimap semantics.
609624
message MapStateSpec {
625+
// (Required) The id of the Coder for map keys.
610626
string key_coder_id = 1;
627+
// (Required) The id of the Coder for map values.
611628
string value_coder_id = 2;
612629
}
613630

631+
// Specification for a multimap state cell, which holds a key-to-multiple-values
632+
// mapping per key and window. A single key can be associated with multiple values,
633+
// analogous to a multimap.
614634
message MultimapStateSpec {
635+
// (Required) The id of the Coder for map keys.
615636
string key_coder_id = 1;
637+
// (Required) The id of the Coder for map values.
616638
string value_coder_id = 2;
617639
}
618640

641+
// Specification for a set state cell, which holds an unordered collection of
642+
// unique elements per key and window. Elements can be added, removed, and checked
643+
// for existence.
619644
message SetStateSpec {
645+
// (Required) The id of the Coder for elements stored in this set.
620646
string element_coder_id = 1;
621647
}
622648

649+
// Specification for a timer family, which groups timers that share the same
650+
// time domain and encoding. Timer families allow timers to be managed together,
651+
// including batch processing of expired timers.
623652
message TimerFamilySpec {
653+
// (Required) The time domain for this timer family (event time or processing time).
624654
TimeDomain.Enum time_domain = 1;
655+
// (Required) The id of the Coder for timers in this family.
625656
string timer_family_coder_id = 2;
626657
}
627658

659+
// Indicates whether a PCollection is bounded (finite, known size) or unbounded (infinite, unknown size).
660+
// This affects how runners execute the pipeline and which features are available.
628661
message IsBounded {
629662
enum Enum {
630663
UNSPECIFIED = 0;
@@ -811,7 +844,13 @@ message GroupIntoBatchesPayload {
811844
int64 max_buffering_duration_millis = 2;
812845
}
813846

847+
// Payload for the RedistributeByKey and RedistributeArbitrarily composite transforms.
848+
// These transforms redistribute elements across workers, optionally allowing duplicates
849+
// to improve throughput at the cost of additional processing.
814850
message RedistributePayload {
851+
// (Optional) If true, the redistribution may produce duplicate elements.
852+
// This can improve performance by avoiding costly deduplication, but requires
853+
// downstream transforms to be tolerant of duplicates.
815854
bool allow_duplicates = 1;
816855
}
817856

@@ -1330,8 +1369,9 @@ message Trigger {
13301369
message Default {
13311370
}
13321371

1333-
// Ready whenever the requisite number of input elements have arrived
1372+
// Ready whenever the requisite number of input elements have arrived.
13341373
message ElementCount {
1374+
// (Required) The number of elements that must arrive before this trigger fires.
13351375
int32 element_count = 1;
13361376
}
13371377

@@ -1477,11 +1517,12 @@ message StandardArtifacts {
14771517
}
14781518
}
14791519

1520+
// Payload for a file-based artifact, referencing a locally-accessible file on disk.
14801521
message ArtifactFilePayload {
1481-
// a string for an artifact file path e.g. "/tmp/foo.jar"
1522+
// (Required) A file path for an artifact e.g. "/tmp/foo.jar"
14821523
string path = 1;
14831524

1484-
// The hex-encoded sha256 checksum of the artifact.
1525+
// (Optional) The hex-encoded sha256 checksum of the artifact.
14851526
string sha256 = 2;
14861527
}
14871528

@@ -1498,11 +1539,12 @@ message EmbeddedFilePayload {
14981539
bytes data = 1;
14991540
}
15001541

1542+
// Payload for a PyPI artifact, describing a Python package dependency.
15011543
message PyPIPayload {
1502-
// Pypi compatible artifact id e.g. "apache-beam"
1544+
// (Required) A PyPI-compatible artifact id e.g. "apache-beam"
15031545
string artifact_id = 1;
15041546

1505-
// Pypi compatible version string.
1547+
// (Required) A PyPI-compatible version string, e.g. "2.59.0"
15061548
string version = 2;
15071549
}
15081550

@@ -1515,29 +1557,40 @@ message MavenPayload {
15151557
string repository_url = 2;
15161558
}
15171559

1560+
// Payload for a deferred artifact, where the interpretation of the data is
1561+
// deferred to the creator. This allows custom artifact types not covered by
1562+
// the standard artifact types.
15181563
message DeferredArtifactPayload {
1519-
// A unique string identifier assigned by the creator of this payload. The creator may use this key to confirm
1564+
// (Required) A unique string identifier assigned by the creator of this payload. The creator may use this key to confirm
15201565
// whether they can parse the data.
15211566
string key = 1;
15221567

1523-
// Data for deferred artifacts. Interpretation of bytes is delegated to the creator of this payload.
1568+
// (Required) Data for deferred artifacts. Interpretation of bytes is delegated to the creator of this payload.
15241569
bytes data = 2;
15251570
}
15261571

1572+
// Payload for the staging_to role, used when an artifact needs to be staged
1573+
// to a particular location. The staged name is relative to the staging directory.
15271574
message ArtifactStagingToRolePayload {
1528-
// A generated staged name (relative path under staging directory).
1575+
// (Required) A generated staged name (relative path under staging directory).
15291576
string staged_name = 1;
15301577
}
15311578

1579+
// Full descriptor of an artifact, including its type and role.
1580+
// Used to describe dependencies of an Environment.
15321581
message ArtifactInformation {
1533-
// A URN that describes the type of artifact
1582+
// (Required) A URN that describes the type of artifact (e.g. file, URL, embedded, PyPI, Maven).
1583+
// See StandardArtifacts.Types for well-known URNs.
15341584
string type_urn = 1;
15351585

1586+
// (Optional) The payload for the artifact type, as determined by type_urn.
15361587
bytes type_payload = 2;
15371588

1538-
// A URN that describes the role of artifact
1589+
// (Required) A URN that describes the role of the artifact (e.g. staging_to, go_worker_binary).
1590+
// See StandardArtifacts.Roles for well-known URNs.
15391591
string role_urn = 3;
15401592

1593+
// (Optional) The payload for the artifact role, as determined by role_urn.
15411594
bytes role_payload = 4;
15421595
}
15431596

@@ -1598,24 +1651,42 @@ message StandardEnvironments {
15981651
}
15991652
}
16001653

1601-
// The payload of a Docker image
1654+
// Payload for a Docker container environment.
1655+
// The container image is assumed to be linux_amd64.
16021656
message DockerPayload {
1657+
// (Required) The Docker container image URL, e.g. "apache/beam_java_sdk:2.59.0"
16031658
string container_image = 1; // implicitly linux_amd64.
16041659
}
16051660

1661+
// Payload for a native process environment, where the SDK harness is launched as
1662+
// a subprocess directly on the worker machine (not inside a container).
16061663
message ProcessPayload {
1664+
// (Required) The operating system, e.g. "linux", "darwin".
16071665
string os = 1; // "linux", "darwin", ..
1666+
// (Required) The CPU architecture, e.g. "amd64", "arm64".
16081667
string arch = 2; // "amd64", ..
1668+
// (Required) The command to execute to start the SDK harness process.
16091669
string command = 3; // process to execute
1670+
// (Optional) Environment variables to set for the SDK harness process.
16101671
map<string, string> env = 4; // Environment variables
16111672
}
16121673

1674+
// Payload for an external process environment, where the SDK harness is managed
1675+
// by an external service rather than directly by the runner. The runner communicates
1676+
// with the external worker pool via the provided gRPC endpoint.
16131677
message ExternalPayload {
1678+
// (Required) The gRPC endpoint serving the BeamFnExternalWorkerPool API.
16141679
ApiServiceDescriptor endpoint = 1; // Serving BeamFnExternalWorkerPool API.
1680+
// (Optional) Arbitrary extra parameters to pass to the external worker pool.
16151681
map<string, string> params = 2; // Arbitrary extra parameters to pass
16161682
}
16171683

1684+
// Payload for an AnyOf environment, which presents a set of equivalent environments
1685+
// that a runner may choose from. Each alternative is fully specified with its own
1686+
// dependencies, capabilities, etc. This allows SDKs to express flexibility in
1687+
// execution environment while preserving compatibility across runners.
16181688
message AnyOfEnvironmentPayload {
1689+
// (Required) The list of fully-specified environments the runner may choose from.
16191690
// Each is fully contained (with their own dependencies, capabilities, etc.)
16201691
repeated Environment environments = 1;
16211692
}
@@ -1848,6 +1919,8 @@ message StandardDisplayData {
18481919
}
18491920
}
18501921

1922+
// A labelled display data payload, associating a human-readable label with a value.
1923+
// Used as the payload for the StandardDisplayData.LABELLED URN.
18511924
message LabelledPayload {
18521925
// (Required) A human readable label for the value.
18531926
string label = 1;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ message ApiServiceDescriptor {
3939
AuthenticationSpec authentication = 2;
4040
}
4141

42+
// Describes the authentication mechanism for connecting to a Beam API endpoint.
43+
// Uses a URN-based approach to allow different authentication methods (e.g. OAuth2,
44+
// bearer tokens) to be specified in an extensible manner.
4245
message AuthenticationSpec {
4346
// (Required) A URN that describes the accompanying payload.
4447
// For any URN that is not recognized (by whomever is inspecting

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,32 +60,48 @@ message ExpansionMethods {
6060
}
6161

6262
// Defines the URNs for managed transforms.
63+
// Managed transforms are high-level, pre-configured transforms that map to
64+
// specific SchemaTransform implementations. They provide a convenient way
65+
// to use common I/O patterns without specifying the full transform details.
6366
message ManagedTransforms {
6467
enum Urns {
68+
// Reads from an Iceberg table.
6569
ICEBERG_READ = 0 [(org.apache.beam.model.pipeline.v1.beam_urn) =
6670
"beam:schematransform:org.apache.beam:iceberg_read:v1"];
71+
// Writes to an Iceberg table.
6772
ICEBERG_WRITE = 1 [(org.apache.beam.model.pipeline.v1.beam_urn) =
6873
"beam:schematransform:org.apache.beam:iceberg_write:v1"];
74+
// Reads from a Kafka topic.
6975
KAFKA_READ = 2 [(org.apache.beam.model.pipeline.v1.beam_urn) =
7076
"beam:schematransform:org.apache.beam:kafka_read:v1"];
77+
// Writes to a Kafka topic.
7178
KAFKA_WRITE = 3 [(org.apache.beam.model.pipeline.v1.beam_urn) =
7279
"beam:schematransform:org.apache.beam:kafka_write:v1"];
80+
// Reads from BigQuery using the Storage API.
7381
BIGQUERY_READ = 4 [(org.apache.beam.model.pipeline.v1.beam_urn) =
7482
"beam:schematransform:org.apache.beam:bigquery_storage_read:v1"];
83+
// Writes to BigQuery.
7584
BIGQUERY_WRITE = 5 [(org.apache.beam.model.pipeline.v1.beam_urn) =
7685
"beam:schematransform:org.apache.beam:bigquery_write:v1"];
86+
// Reads from Iceberg in CDC (Change Data Capture) mode.
7787
ICEBERG_CDC_READ = 6 [(org.apache.beam.model.pipeline.v1.beam_urn) =
7888
"beam:schematransform:org.apache.beam:iceberg_cdc_read:v1"];
89+
// Reads from a PostgreSQL database.
7990
POSTGRES_READ = 7 [(org.apache.beam.model.pipeline.v1.beam_urn) =
8091
"beam:schematransform:org.apache.beam:postgres_read:v1"];
92+
// Writes to a PostgreSQL database.
8193
POSTGRES_WRITE = 8 [(org.apache.beam.model.pipeline.v1.beam_urn) =
8294
"beam:schematransform:org.apache.beam:postgres_write:v1"];
95+
// Reads from a MySQL database.
8396
MYSQL_READ = 9 [(org.apache.beam.model.pipeline.v1.beam_urn) =
8497
"beam:schematransform:org.apache.beam:mysql_read:v1"];
98+
// Writes to a MySQL database.
8599
MYSQL_WRITE = 10 [(org.apache.beam.model.pipeline.v1.beam_urn) =
86100
"beam:schematransform:org.apache.beam:mysql_write:v1"];
101+
// Reads from a SQL Server database.
87102
SQL_SERVER_READ = 11 [(org.apache.beam.model.pipeline.v1.beam_urn) =
88103
"beam:schematransform:org.apache.beam:sql_server_read:v1"];
104+
// Writes to a SQL Server database.
89105
SQL_SERVER_WRITE = 12 [(org.apache.beam.model.pipeline.v1.beam_urn) =
90106
"beam:schematransform:org.apache.beam:sql_server_write:v1"];
91107
}
@@ -143,6 +159,9 @@ message BuilderMethod {
143159
bytes payload = 3;
144160
}
145161

162+
// Defines annotation keys used to attach metadata to transforms in the
163+
// portable pipeline representation. These annotations allow SDKs to
164+
// recover configuration information that was used to construct a transform.
146165
message Annotations {
147166
enum Enum {
148167
// The annotation key for the encoded configuration Row used to build a transform

0 commit comments

Comments
 (0)