[Go SDK] Add pass through registration for the fixed and variable length string and bytes logical types (#40156)

* [Go SDK] Encode INT16 row fields as big endian to match Java and Python

The reflection based row coder used the varint encoding for int16 and
uint16 fields. Java and Python encode the INT16 schema type as 2 big
endian bytes, so rows with such fields could not be exchanged with the
other SDKs.

Fixes #40151. Part of #39684.

* [Go SDK] Convert logical type arguments to and from schema protos

Logical types registered with an argument now emit argument_type and
argument in their FieldType, and schemas from other SDKs are matched on
the URN and the argument value. A logical type registered without an
argument still matches any argument, so pass through types keep
working. Top level logical types carry the argument in a schema option.

Part of #39684.

* [Go SDK] Add portable logical type registration and standard date and micros_instant types

schema.RegisterLogicalTypeConversion registers a logical type identified
by a URN together with the conversions between its Go type and its
storage type, and derives the row coder from the storage type.
schema.RegisterLogicalTypeCoder does the same for logical types whose
wire encoding differs from the row encoding of the storage type. The
standard beam:logical_type:date:v1 and beam:logical_type:micros_instant:v1
logical types are registered by default as schema.Date and
schema.MicrosInstant.

The standard coder regression test now builds the expected row from the
schema in the coder payload, decodes payload bytes above 0x7f, counts
encoding mismatches as failures, and runs the micros_instant case.

Part of #39684.

* [Go SDK] Add the standard millis_instant and decimal logical types

schema.MillisInstant encodes as the Java InstantCoder does: 8 big endian
bytes of the milliseconds shifted by the minimum int64. schema.Decimal
encodes as the Java BigDecimalCoder does: the scale as a varint followed
by the length prefixed two's complement bytes of the unscaled value.
Both cases of standard_coders.yaml now run in the Go regression test.

Part of #39684.

* [Go SDK] Add pass through registration for the fixed and variable length string and bytes logical types

schema.RegisterPassThroughLogicalType maps a logical type URN to the Go
type of its representation without mapping that Go type back, so a
schema field with the URN decodes with the plain row encoding and the
length argument is ignored. The standard fixed_char, var_char,
fixed_bytes and var_bytes logical types are registered this way, and
their standard_coders.yaml case now runs in the Go regression test.

Part of #39684.

* Put logical type release note in the active release section

* Test public pass-through logical type registration and validation

* Reject pointer types in pass-through logical type registration

* [Go SDK] Address review nits in the pass-through logical type tests

Separate the call and check sections with blank lines, say what a
failing check wanted, and explain the repeated identical registration.
5 files changed
tree: 381c0f8ac87b214017d96d766840b3258218c9e7
  1. .agent/
  2. .gemini/
  3. .github/
  4. .test-infra/
  5. buildSrc/
  6. contributor-docs/
  7. dev-support/
  8. examples/
  9. gradle/
  10. infra/
  11. it/
  12. learning/
  13. model/
  14. playground/
  15. plugins/
  16. release/
  17. runners/
  18. scripts/
  19. sdks/
  20. vendor/
  21. website/
  22. .asf.yaml
  23. .editorconfig
  24. .gitattributes
  25. .gitignore
  26. .gitmodules
  27. .mailmap
  28. .pre-commit-config.yaml
  29. .yamllint.yml
  30. assembly.xml
  31. build.gradle.kts
  32. CHANGES.md
  33. CI.md
  34. CONTRIBUTING.md
  35. gradle.properties
  36. gradlew
  37. gradlew.bat
  38. LICENCE.cloudpickle
  39. LICENSE
  40. LICENSE.python
  41. local-env-setup.sh
  42. NOTICE
  43. README.md
  44. settings.gradle.kts
  45. start-build-env.sh
README.md

Apache Beam

Apache Beam is a unified model for defining both batch and streaming data-parallel processing pipelines, as well as a set of language-specific SDKs for constructing pipelines and Runners for executing them on distributed processing backends, including Apache Flink, Apache Spark, Google Cloud Dataflow, and Hazelcast Jet.

πŸš€ Quick Start (Beginner Friendly)

If you're new to Apache Beam, start here:

  1. Choose a language:

  2. Run your first example:

    • Minimal WordCount example (available in this repository)
  3. Understand core concepts:

    • PCollection
    • PTransform
    • Pipeline

Status

Maven Central PyPI version Go version Python coverage Build python source distribution and wheels Python tests Java tests Go tests

Overview

Beam provides a general approach to expressing embarrassingly parallel data processing pipelines and supports three categories of users, each of which have relatively disparate backgrounds and needs.

  1. End Users: Writing pipelines with an existing SDK, running it on an existing runner. These users want to focus on writing their application logic and have everything else just work.
  2. SDK Writers: Developing a Beam SDK targeted at a specific user community (Java, Python, Scala, Go, R, graphical, etc). These users are language geeks and would prefer to be shielded from all the details of various runners and their implementations.
  3. Runner Writers: Have an execution environment for distributed processing and would like to support programs written against the Beam Model. Would prefer to be shielded from details of multiple SDKs.

The Beam Model

The model behind Beam evolved from several internal Google data processing projects, including MapReduce, FlumeJava, and Millwheel. This model was originally known as the β€œDataflow Model”.

To learn more about the Beam Model (though still under the original name of Dataflow), see the World Beyond Batch: Streaming 101 and Streaming 102 posts on O’Reilly’s Radar site, and the VLDB 2015 paper.

The key concepts in the Beam programming model are:

  • PCollection: represents a collection of data, which could be bounded or unbounded in size.
  • PTransform: represents a computation that transforms input PCollections into output PCollections.
  • Pipeline: manages a directed acyclic graph of PTransforms and PCollections that is ready for execution.
  • PipelineRunner: specifies where and how the pipeline should execute.

SDKs

Beam supports multiple language-specific SDKs for writing pipelines against the Beam Model.

Currently, this repository contains SDKs for Java, Python and Go.

Have ideas for new SDKs or DSLs? See the sdk-ideas label.

Specific SDK Readmes

Runners

Beam supports executing programs on multiple distributed processing backends through PipelineRunners. Currently, the following PipelineRunners are available:

  • The DirectRunner runs the pipeline on your local machine.
  • The PrismRunner runs the pipeline on your local machine using Beam Portability.
  • The DataflowRunner submits the pipeline to the Google Cloud Dataflow.
  • The FlinkRunner runs the pipeline on an Apache Flink cluster. The code has been donated from dataArtisans/flink-dataflow and is now part of Beam.
  • The SparkRunner runs the pipeline on an Apache Spark cluster.
  • The JetRunner runs the pipeline on a Hazelcast Jet cluster. The code has been donated from hazelcast/hazelcast-jet and is now part of Beam.

Have ideas for new Runners? See the runner-ideas label.

Instructions for building and testing Beam itself are in the contribution guide.

πŸ“š Learn More

Here are some resources actively maintained by the Beam community to help you get started:

Contact Us

To get involved with Apache Beam: