[Cherry-pick to branch-1.3] [#12734] fix(flink-connector): skip no-op table alter to avoid updates must not be empty - #12771
Merged
jerryshao merged 2 commits intoSep 1, 2026
Conversation
…updates must not be empty (apache#12735) ### What changes were proposed in this pull request? Skip forwarding an empty TableChange list to Gravitino when altering a table through the Flink connector. This covers all three code paths that could produce an empty change set: GravitinoHiveCatalog.applyGenericTableAlter (generic tables with no property/comment diff) BaseCatalog.alterTable(tablePath, newTable, ignoreIfNotExists) (comment-only alter with unchanged comment) BaseCatalog.alterTable(tablePath, newTable, tableChanges, ignoreIfNotExists) (empty Flink tableChanges) A new private helper BaseCatalog.alterGravitinoTable centralizes the empty-change guard for the native paths and only invalidates the native cache when an alter is actually performed. ### Why are the changes needed? When an ALTER TABLE results in no effective change, the connector produced an empty update list and called TableCatalog.alterTable. Server-side TableUpdatesRequest.validate() rejects empty updates with IllegalArgumentException: updates must not be empty, failing an effectively no-op alter (for example an idempotent ALTER TABLE on job startup). Fix: apache#12734 ### Does this PR introduce _any_ user-facing change? No new APIs or property keys. Behavior change: an ALTER TABLE that results in no actual change now succeeds as a no-op instead of failing. ### How was this patch tested? Added unit tests: TestGravitinoHiveCatalog: no-op generic alter is skipped; property change is forwarded. TestBaseCatalog: empty tableChanges skipped; comment-only unchanged skipped; comment change forwarded. Ran ./gradlew :flink-connector:flink-common:test --tests "org.apache.gravitino.flink.connector.catalog.TestBaseCatalog" --tests "org.apache.gravitino.flink.connector.hive.TestGravitinoHiveCatalog" -PskipITs — all pass. Spotless applied. # Conflicts: # flink-connector/flink-common/src/test/java/org/apache/gravitino/flink/connector/catalog/TestBaseCatalog.java # flink-connector/flink-common/src/test/java/org/apache/gravitino/flink/connector/hive/TestGravitinoHiveCatalog.java
Code Coverage Report
Files
|
jerryshao
approved these changes
Sep 1, 2026
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.
What changes were proposed in this pull request?
This is the branch-1.3 backport of #12735 (cherry-pick of commit 4b529ce). It resolves the cherry-pick conflicts introduced because branch-1.3 differs from main:
TestBaseCatalog.java: added the imports that exist on main but are missing on branch-1.3 (ObjectPath,TableNotExistException,TableCatalog) and dropped the conflictingCatalogExceptionimport that is unused here.TestGravitinoHiveCatalog.java: removedtestGetTableThrowsCatalogExceptionWhenForbidden(and its now-unused imports). That test is not part of this fix and depends on theForbiddenException->CatalogExceptionconversion ingetTable, which does not exist on branch-1.3.The core fix is unchanged from #12735: skip forwarding an empty
TableChangelist to Gravitino when a table alter results in no actual change.Why are the changes needed?
A no-op
ALTER TABLEproduced an empty update list, which the server rejects withIllegalArgumentException: updates must not be empty, failing the Flink job. This backports the fix to branch-1.3.Fix: #12734
Does this PR introduce any user-facing change?
No
How was this patch tested?
./gradlew :flink-connector:flink-common:check -PskipITspasses on branch-1.3.