Skip to content

[FLINK-39142] Add Glue Schema Registry Protobuf SQL format factory (stacked on Avro #236) - #2

Merged
fmorillo7694 merged 5 commits into
gsr-avro-sql-formatfrom
gsr-protobuf-sql-format-stacked
Aug 10, 2026
Merged

[FLINK-39142] Add Glue Schema Registry Protobuf SQL format factory (stacked on Avro #236)#2
fmorillo7694 merged 5 commits into
gsr-avro-sql-formatfrom
gsr-protobuf-sql-format-stacked

Conversation

@fmorillo7694

@fmorillo7694 fmorillo7694 commented Aug 8, 2026

Copy link
Copy Markdown
Owner

[FLINK-39142] Add Glue Schema Registry Protobuf SQL format factory

Stacked PR — this builds on the Avro GSR SQL format work in
apache#236 (apache#236).

Reviewing only the top commit ([FLINK-39142]) gives a clean, Protobuf-only diff
(21 files). The Avro commit below it is the stacking base and lands via apache#236.

What this adds

A Glue Schema Registry Protobuf SQL format for Flink SQL, mirroring the Avro
format's structure:

Module Path
Format impl flink-formats-aws/flink-protobuf-glue-schema-registry/
SQL uber-jar flink-formats-aws/flink-sql-protobuf-glue-schema-registry/
E2E tests flink-connector-aws-e2e-tests/flink-formats-protobuf-glue-schema-registry-e2e-tests/
Docs docs/content/docs/connectors/table/formats/protobuf-glue.md, docs/data/protobuf-glue.yml
Wiring flink-formats-aws/pom.xml (+2 modules), flink-connector-aws-e2e-tests/pom.xml (+1)

Review findings addressed (from the Schema Registry deep-dive review)

  • B4 — TIMESTAMP/TIMESTAMP_LTZ → epoch-millis int64, DATE/TIME → int32,
    DECIMAL → lossless BigDecimal text; encode/decode via the correct RowData
    accessors (fixes the getString() ClassCastException).
  • C3 — ARRAY/MAP/MULTISET/ROW/RAW now fail fast
    (UnsupportedOperationException) instead of silently coercing to string.
  • C4 — column names sanitized to valid proto identifiers; the original SQL name
    is preserved as the field's json_name.
  • V2protobuf-java + protobuf-java-util pinned to a single
    <protobuf.version> (3.25.5).

Review blockers resolved in this revision (2026-08-09)

  • B1 (Blocker) — decode now routes through the GSR deserialization facade: bytes are parsed with the WRITER descriptor fetched from the registry, then mapped to RowData by field name (FacadeGsrProtobufReader/GsrProtobufReader). Unknown fields -> null for nullable columns, error for NOT NULL.
  • C1 (Critical) — read path now decompresses via the GSR facade; locked in by ZLIB compression round-trip regression tests.
  • C2 (Critical) — generated proto3 schemas emit explicit presence (optional) for NULLABLE columns; null <-> default round-trip regression test added.
  • V1 (High)glue.schema.registry.version bumped 1.1.18 -> 1.1.25 (in the base Avro commit).

Verification

  • mvn -pl flink-formats-aws/flink-protobuf-glue-schema-registry -am test (JDK 17) →
    BUILD SUCCESS, 15 tests, 0 failures, 0 errors
    (GlueSchemaRegistryProtobufFormatFactoryTest, ProtobufTypeCoverageTest,
    GsrProtobufRoundTripPropertyTest, ProtobufRoundTripIntegrationTest).
  • mvn spotless:check on the module → clean.
  • SQL uber-jar + Protobuf E2E modules package -DskipTests → BUILD SUCCESS.

JSON GSR SQL format support will follow as a separate PR stacked off the Avro head
in parallel with this one.

End-to-end SQL test (real Glue Schema Registry)

New GlueSchemaRegistryProtobufSqlKinesisITCase converts the manual driver to the repo's credential-gated e2e convention (Localstack Kinesis + real AWS GSR, @Tag("requires-aws-credentials"), skips without IT_CASE_GLUE_SCHEMA_* creds). Scenarios: multi-row round-trip with auto-registration, nullable columns with real NULLs (exercises the proto3 explicit-presence fix), and ZLIB compression round-trip (exercises the read-path decompression fix).

@fmorillo7694
fmorillo7694 force-pushed the gsr-protobuf-sql-format-stacked branch 5 times, most recently from ed5a903 to dda7aab Compare August 8, 2026 20:30
@fmorillo7694
fmorillo7694 force-pushed the gsr-protobuf-sql-format-stacked branch 4 times, most recently from 225d444 to fc0d637 Compare August 10, 2026 10:12
Add the `protobuf-glue` Flink SQL format that serializes/deserializes
RowData through AWS Glue Schema Registry, stacked on the Avro SQL format
(PR apache#236). Mirrors the Avro module layout: format factory + options,
RowType<->Protobuf converters, schema converter, RowData ser/de schemas,
SQL uber-jar module, docs, and E2E test module.

Applies the following review findings on top of the candidate
implementation:

- B4: encode/decode TIMESTAMP and TIMESTAMP_LTZ as epoch-millis int64,
  DATE/TIME as int32, and DECIMAL as its lossless BigDecimal text form,
  using the correct RowData accessors instead of getString() (which
  previously threw ClassCastException for these very common types).
- C3: fail fast for genuinely unsupported complex types (ARRAY, MAP,
  MULTISET, ROW, RAW) instead of silently coercing them to `string`.
- C4: sanitize column names to valid proto field identifiers and carry
  the original SQL name as the field's json_name, avoiding
  DescriptorValidationException at open() for names with spaces,
  hyphens, or a leading digit.
- V2: pin protobuf-java and protobuf-java-util to a single
  <protobuf.version> property (3.25.x) to remove the version-skew risk
  between the two artifacts.

Adds ProtobufTypeCoverageTest covering the temporal/decimal round-trips,
field-name sanitization + json_name preservation, and the fail-fast path.
Module builds green: 15 tests pass (mvn test, JDK 17), spotless clean.

Known follow-ups (tracked in the GSR review, deferred): the SQL decode
path still strips the fixed GSR header and rebuilds the reader descriptor
from the local RowType rather than resolving the writer schema through the
GSR deserialization facade (finding B1), so compression is not yet
symmetric on read (C1) and proto3 implicit presence keeps null<->default
round-trips lossy (C2).
@fmorillo7694
fmorillo7694 force-pushed the gsr-protobuf-sql-format-stacked branch from fc0d637 to afaa483 Compare August 10, 2026 10:26
@fmorillo7694
fmorillo7694 merged commit e4d61fc into gsr-avro-sql-format Aug 10, 2026
8 checks passed
fmorillo7694 added a commit that referenced this pull request Aug 10, 2026
feat(glue-schema-registry): Add JSON SQL format factory (stacked on Protobuf #2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant