[FLINK-29549]- Flink Glue Catalog integration - #206
fmorillo7694 wants to merge 28 commits into
Conversation
Co-Authored-By: Anthony Pounds-Cornish <antpc@amazon.co.uk>
refactoring directory Adding Parent Pom
Samrat002
left a comment
There was a problem hiding this comment.
Thanks for the contribution. A few points to note:
It looks like most of the code has already been reviewed across multiple PRs.
Concerns:
-
The current implementation exposes low-level Glue details (e.g., support for lowercase table names) directly through the Flink Catalog. Is this acceptable? I recommend raising this topic with the community. In my opinion, it would be better to encapsulate such Glue-specific behavior and avoid exposing it directly via the Flink Catalog interface. The catalog's behavior should remain consistent with other catalogs, with differences controlled via configuration only.
-
Please consider implementing the basic configuration options defined in FLIP-277. If that’s not feasible in this PR, a fast follow-up would be valuable, especially for users relying on different credential modes.
-
It seems that some
.ideafolder files have been committed. Please remove them from the PR.
Cheers,
Samrat
Hey Samrat. How could we encapsulate this specific issues? From user perspective we are already limiting them creating tables and databases with uppercase. In regards of the schema, we encapsulate storing the actual original columnNames in column parameters in Glue, so even though user sees their schema in glue with lower case (default for glue). we actually leverage the original column name.
|
Thanks for the detailed response. Can you help me understand the technical complexity to support CaseSensitivity from GlueCatalog? This is a deviation.
We can start a thread in the community to discuss this approach. I am fine with either of the approaches as long as the community agrees on it. |
|
@Samrat002 @FranMorilloAWS about case sensitivity, these are the logical rules I suggest:
I would add that the way the additional metadata (the original name and any additional info required) is stored in Glue should be clearly documented, in case a user want's to build their own external interface to extract or update information in the Glue Catalog. |
Hello @Samrat002 @nicusX. Using Database Parameters and Table Parameters we are now able to use lower/upper case for defining the Database and Table Name. By using the Show Tables/Show Databases, Describe table commands, we will show the original Flink Definition, even though in Glue UI it will be all in lower case |
|
Thanks for incorporating the changes. I will review the pr in next couple of days . |
Samrat002
left a comment
There was a problem hiding this comment.
Patch looks great. Thank you for making the change.
minor comments
Cheers,
Samrat
|
Can we refer to Paimon's solution for integrating Glue? https://issues.apache.org/jira/browse/FLINK-38457 @FranMorilloAWS |
|
@melin. To me knowledge Paimon integration with Glue Data Catalog is to store Paimon Tables in Glue, however it wouldnt work for storing Kinesis, MSK, and other streaming sources. They have different implementations. |
- Remove scala.binary.version property (Flink 2.0 dropped Scala deps) - Replace flink-table-planner_2.12 with flink-table-planner-loader - Migrate CatalogTable.of() to CatalogTable.newBuilder() API (removed in Flink 2.0) - All 120 tests pass
ee90672 to
a7e1c06
Compare
…t partition operations (G1) Fixes three of the four HIGH findings from the Glue Data Catalog review (B1 constructor client wiring was already fixed on this branch): - B2: buildTableInput now persists partitionKeys and the table comment (description) on the Glue TableInput; createRegularTable splits data columns (storage descriptor) from partition columns (TableInput), so partition metadata declared in DDL survives the round-trip. - B3: column names are no longer force-lowercased with an originalName side-channel parameter; the declared case is stored directly in Glue. Legacy tables carrying the originalName parameter are still honored on read for backwards compatibility. - G1: partition operations are implemented against the Glue partition APIs (GetPartitions with pagination, GetPartition, CreatePartition, UpdatePartition, DeletePartition) via a new GluePartitionOperator, following the existing operator pattern and the Flink Catalog contract for exceptions (TableNotPartitionedException, PartitionNotExist, PartitionAlreadyExists, PartitionSpecInvalid). listPartitionsByFilter intentionally remains unsupported; Flink's planner falls back to listPartitions. Read path: getSchemaFromGlueTable now appends partition columns (stored at the Glue table level) to the schema so CatalogTable partition keys resolve, and tolerates a null storage descriptor. Tests: FakeGlueClient gains an in-memory partition store and persists TableInput.partitionKeys; new regression tests cover the partitioned round-trip (B2), case preservation + legacy-compat read (B3), and the full partition CRUD lifecycle incl. contract exceptions (G1). 126 tests pass; spotless clean.
fix(catalog): Persist partition metadata, preserve column case, implement partition ops
…terTable Real-AWS integration testing (us-west-2) proved that Glue lowercases column names on CreateTable, breaking the assumption introduced when the originalName column parameter write was removed: DESCRIBE lost declared case, SELECT on mixed-case columns failed to resolve, and streaming jobs against catalog-registered tables could not plan. Changes, each validated against a real Glue Data Catalog: - Store columns lowercase with the declared name in the originalName column parameter; restore it on read (round-trip now exact). - Partition columns: Glue rejects column-level parameters on partition keys (400: Parameters not supported for partition columns), so their declared case is preserved in an order-preserving table-level parameter (flink.original-partition-keys) instead. - Implement alterTable via Glue UpdateTable (was UnsupportedOperationException), preserving the original table name. - Filter the new internal parameter from user-visible table options. Verified with a 25-step real-AWS integration suite: full DDL surface (mixed-case databases/tables/columns, describe, alter, partitions add/show/drop) plus a real streaming job writing to and reading from Kinesis through source/sink tables registered in the Glue catalog, including JSON field-name case verification on the wire. 25/25 PASS. Unit tests: 126/126.
…ixes fix(catalog): Preserve column case against real Glue; implement alterTable
Real AWS Glue integration test results (design rationale for
|
- Simplify GlueCatalog#close(): remove retry logic, SDK close() is best-effort and does not surface exceptions (leekeiabstraction) - Remove leftover comment in GlueCatalogFactory (Samrat002) - Initialize glueFunctions list in GlueFunctionOperator#listGlueFunctions so it can never be null (Samrat002) - Add null checks on GlueOperator constructor params (Samrat002) - Docs: clarify DataStream API usage via table conversion and link the AWS credentials configuration guide (Samrat002) - Post-merge sync: bump flink-catalog-aws modules to 6.1-SNAPSHOT, add missing ASF license headers to 7 test files, apply updated spotless formatting from flink-connector-parent 2.0.0
|
@Samrat002 All open review threads are now addressed and resolved as of 002c0fb:
The branch is also synced with The CI workflow run on the new head is waiting for approval ( |
The planner probes getFunction on the session's current database for every SQL expression and only falls back to built-in functions on FunctionNotExistException. getFunction threw a bare CatalogException when the database did not exist, so any expression query failed SQL validation whenever the current database was absent from Glue. Report FunctionNotExistException instead, matching the Catalog contract and the Hive/GenericInMemoryCatalog behaviour.
Adds wire-level integration tests running against a moto Glue emulator in Testcontainers on every CI push: GlueCatalogMotoITCase (catalog API over the real SDK wire path) and GlueCatalogSqlMotoITCase (full SQL path: CREATE CATALOG -> SPI factory -> planner -> wire, routed via the aws.endpointUrlGlue system property). Makes the whole fake-backed unit suite executable against real AWS Glue: GlueTestClientFactory switches the injected client when IT_CASE_GLUE_CATALOG_* credentials (or the default-chain flag) are present, RealGlueCleanupExtension removes databases created by each test via snapshot-delta. Test databases now use per-test unique names (real Glue deletes databases asynchronously, so fixed names race the previous test's in-flight deletion), table operation tests create their database (real Glue rejects table calls in absent databases), and fault-injection tests skip outside fake mode. Also adds a regression test for the getFunction contract fix. CI behaviour is unchanged: without credentials everything runs against the fake.
New flink-catalog-aws-glue-e2e-tests module following the repository's e2e convention: compiled by every CI run, executed only under -Prun-aws-end-to-end-tests with IT_CASE_GLUE_CATALOG_* credentials (or IT_CASE_GLUE_CATALOG_USE_DEFAULT_CREDENTIALS=true for SSO/instance profiles), skipping cleanly otherwise. GlueCatalogEndToEndITCase runs the complete user path against real AWS Glue: CREATE CATALOG via SPI factory, database/table lifecycle through SQL DDL, real Glue's column lowercasing with case restoration through the catalog, dropDatabase (whose emptiness check needs the UDF API unavailable on emulators), and a data round-trip executing a real Flink job between catalog-registered datagen and filesystem tables with read-back through the catalog. The data round-trip is what surfaced the getFunction contract bug fixed in this PR.
Test evidence: full suite executed against real AWS GlueFollowing up on the review discussions about test coverage, the three commits just pushed ( What was run
What the new tiers add
The e2e run also covers the two behaviours only real Glue exhibits: column-name lowercasing with case restoration through the catalog, and Bug found and fixed by the new coverageThe e2e data round-trip immediately surfaced a contract violation no DDL-only test could reach: |
- Remove tracked .idea/ directory from flink-catalog-aws-glue (IDE-local files; the root .gitignore pattern */.idea/ does not match nested modules, which is how these slipped in) - Restore the repository root .idea/vcs.xml that upstream tracks intentionally (.gitignore explicitly un-ignores it) and this branch had deleted - Remove flink-catalog-aws-glue/src/main/resources/META-INF/NOTICE: the module does not shade or bundle any dependencies, so per repository convention (NOTICE only in bundling modules such as the sql-connector fat jars) the file is redundant; its bundled-dependencies section was empty and the jar NOTICE is generated by maven-remote-resources
|
@Samrat002 Good catches, both fixed in 649f4d9: removed the tracked |

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))