[FLINK-24379] Add Glue Schema Registry Avro SQL format factory - #236
Open
fmorillo7694 wants to merge 11 commits into
Open
[FLINK-24379] Add Glue Schema Registry Avro SQL format factory#236fmorillo7694 wants to merge 11 commits into
fmorillo7694 wants to merge 11 commits into
Conversation
fmorillo7694
force-pushed
the
gsr-avro-sql-format
branch
2 times, most recently
from
June 1, 2026 09:05
25b5f7c to
df61bf9
Compare
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 8, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
…glue) Adds a Flink SQL / Table API format factory for AWS Glue Schema Registry with Avro support. Users can now use 'format' = 'avro-glue' in CREATE TABLE statements to read/write Avro data through GSR. Based on the initial implementation by @nicusX. This PR extends that work with: - Shared config infrastructure (GlueFormatOptions, GlueFormatConfigBuilder) - Schema namespace bug fix (avro.namespace, avro.record-name options) - Schema fetch from registry (schema.fetchFromRegistry option) - ProjectableDecodingFormat support - forwardOptions() implementation - Rebase to 6.0-SNAPSHOT - JUnit 5 + AssertJ tests (ported from JUnit 4) - Property-based tests (jqwik) - Integration tests with mock GSR facades Co-authored-by: Nicu Reut <nicureut@gmail.com>
fmorillo7694
force-pushed
the
gsr-avro-sql-format
branch
from
August 9, 2026 10:14
df61bf9 to
5a4edd5
Compare
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 9, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 9, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 10, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 10, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 10, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 10, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
The GSR serialization library casts AWSSchemaRegistryConstants.COMPRESSION_TYPE config value to String; passing the enum object caused ClassCastException at serializer init (found by real-GSR e2e run). Also correct the BACKWARD compatibility e2e scenario: in Avro, removing a field is backward-compatible; the true violation is adding a required field without a default.
fmorillo7694
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 10, 2026
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 10, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
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
added a commit
to fmorillo7694/flink-connector-aws
that referenced
this pull request
Aug 10, 2026
Add the `json-glue` table format (SPI-discovered) that wraps Flink's stock JSON RowData ser/de with an AWS Glue Schema Registry envelope, plus the `flink-sql-json-glue-schema-registry` shaded uber-jar. Stacks on the Protobuf SQL format branch (which stacks on the Avro PR, apache#236), mirroring the established Avro/Protobuf module layout. Review fixes applied to JsonSchemaConverter (see reviews/glue-schema-registry-review.md): - JSON-escape field names (top-level and nested ROW) so a column containing a quote/backslash no longer yields malformed schema JSON. - Fail fast on genuinely unsupported types (MULTISET, RAW, INTERVAL, STRUCTURED, TIMESTAMP_WITH_TIME_ZONE, ...) instead of silently coercing to "string". - Emit "format" keywords for temporal types and "contentEncoding":"base64" for binary; constrain MAP keys to character types. - Emit a "required" array for NOT NULL fields; compose nullable unions directly instead of the brittle indexOf/substring re-parse. Tests: GlueSchemaRegistryJsonFormatFactoryTest (SPI + required-option validation), GsrJsonRoundTripPropertyTest, JsonRoundTripIntegrationTest, and a new JsonSchemaConverterTest (10 cases) covering escaping, fail-fast, formats, base64, map-key validation, required array, and nested rows. Module tests green under JDK 17; SQL uber-jar packages and merges the SPI Factory entry. Deferred (consistent with the Protobuf PR): SQL read path does not yet resolve the writer schema from GSR (no registry query / version-UUID resolution) and compression is not symmetric on read — left as the larger GSR-facade integration follow-up flagged in the review.
[FLINK-39142] Add Glue Schema Registry Protobuf SQL format factory (stacked on Avro apache#236)
Author
|
For reviewers' context: this PR is the first of a planned series adding Glue Schema Registry SQL formats. Protobuf (
Validation done across the series, all against real AWS Glue Schema Registry (Localstack for the Kinesis data plane, per the existing e2e pattern):
Sharing this so the design here can be reviewed with the full series in mind — happy to adjust scope or split differently if preferred. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…glue)
Adds a Flink SQL / Table API format factory for AWS Glue Schema Registry with Avro support. Users can now use 'format' = 'avro-glue' in CREATE TABLE statements to read/write Avro data through GSR.
Based on the initial implementation by @nicusX. This PR extends that work with:
Purpose of the change
For example: Implements the Table API for the Kinesis Source.
Verifying this change
Please make sure both new and modified tests in this PR follows the conventions defined in our code quality guide: https://flink.apache.org/contributing/code-style-and-quality-common.html#testing
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Significant changes
(Please check any boxes [x] if the answer is "yes". You can first publish the PR and check them afterwards, for convenience.)
@Public(Evolving))End-to-end SQL test (real Glue Schema Registry)
GlueSchemaRegistryAvroSqlKinesisITCasereplaces the former manualAvroGlueSqlE2Edriver, following the existing GSR e2e convention (Localstack Kinesis data plane + real AWS Glue Schema Registry,@Tag("requires-aws-credentials"), skips cleanly withoutIT_CASE_GLUE_SCHEMA_ACCESS_KEY/SECRET_KEY). 7 scenarios: basic round-trip, custom namespace/record-name,schema.fetchFromRegistry, complex types (nested ROW/ARRAY/MAP/DECIMAL/TIMESTAMP/nullable), and BACKWARD / NONE / FULL compatibility enforcement. Run with therun-aws-end-to-end-testsprofile.