Skip to content

[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 into
apache:branch-1.3from
geyanggang:cherry-pick-4b529ce4-to-branch-1.3
Sep 1, 2026
Merged

[Cherry-pick to branch-1.3] [#12734] fix(flink-connector): skip no-op table alter to avoid updates must not be empty#12771
jerryshao merged 2 commits into
apache:branch-1.3from
geyanggang:cherry-pick-4b529ce4-to-branch-1.3

Conversation

@geyanggang

Copy link
Copy Markdown
Collaborator

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 conflicting CatalogException import that is unused here.
  • TestGravitinoHiveCatalog.java: removed testGetTableThrowsCatalogExceptionWhenForbidden (and its now-unused imports). That test is not part of this fix and depends on the ForbiddenException -> CatalogException conversion in getTable, which does not exist on branch-1.3.

The core fix is unchanged from #12735: skip forwarding an empty TableChange list to Gravitino when a table alter results in no actual change.

Why are the changes needed?

A no-op ALTER TABLE produced an empty update list, which the server rejects with IllegalArgumentException: 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 -PskipITs passes on branch-1.3.

…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
@geyanggang geyanggang self-assigned this Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 68.09% -0.22% 🟢
Files changed 36.82% 🔴

Module Coverage
aliyun 1.72% 🔴
api 47.7% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 10.4% 🔴
catalog-fileset 80.23% 🟢
catalog-glue 68.95% 🟢
catalog-hive 79.42% 🟢
catalog-jdbc-clickhouse 81.78% 🟢
catalog-jdbc-common 45.48% 🟢
catalog-jdbc-doris 82.36% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-oceanbase 78.6% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 59.18% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.86% 🟢
catalog-lakehouse-paimon 82.14% 🟢
catalog-model 77.72% 🟢
cli 44.51% 🟢
client-java 78.16% 🟢
common 50.75% 🟢
core 83.0% 🟢
filesystem-hadoop3 77.3% 🟢
flink 0.0% 🔴
flink-common 49.22% -7.35% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-common 10.88% 🔴
hive-metastore-common 53.77% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 58.15% 🟢
iceberg-rest-server 73.87% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 24.42% 🔴
lance-rest-server 60.13% 🟢
lineage 53.02% 🟢
optimizer 82.95% 🟢
optimizer-api 21.95% 🔴
server 86.46% 🟢
server-common 76.09% 🟢
spark 28.57% 🔴
spark-common 41.66% 🟢
trino-connector 47.35% 🟢
Files
Module File Coverage
flink-common BaseCatalog.java 41.86% 🔴
GravitinoHiveCatalog.java 18.98% 🔴

@jerryshao
jerryshao merged commit 17cb189 into apache:branch-1.3 Sep 1, 2026
32 checks passed
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.

2 participants