geyanggang opened a new pull request, #12735:
URL: https://github.com/apache/gravitino/pull/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: #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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to