geyanggang opened a new pull request, #13021:
URL: https://github.com/apache/gravitino/pull/13021

   ### What changes were proposed in this pull request?
   
   For Hive-catalog `alterTable` requests that contain only property or comment
   changes, pass an `EnvironmentContext` with `DO_NOT_UPDATE_STATS=true` to the
   Hive Metastore, so it does not recompute table statistics and therefore does
   not access the table's storage location.
   
   - Added an `alterTable(..., boolean skipStatsUpdate)` overload to 
`HiveClient`
     (the existing overload is kept as a default delegating with
     `skipStatsUpdate=false`), `HiveClientImpl`, and `HiveShim`.
   - `HiveShimV2` uses `alter_table_with_environmentContext`; `HiveShimV3` uses 
the
     catalog-aware `alter_table(..., EnvironmentContext)`. The context is built
     internally so the shared client interface stays free of Hive-specific 
types.
   - `HiveCatalogOperations.alterTable` sets `skipStatsUpdate=true` only when 
every
     change is a set/remove property or update comment. Column changes and 
renames
     keep the previous behavior.
   
   ### Why are the changes needed?
   
   A property-only or comment-only alter does not change table data, so the
   metastore statistics recomputation (and the storage-location access it 
triggers,
   e.g. an HDFS `getFileInfo`) is unnecessary. When the filesystem is slow or
   unavailable, such a lightweight alter can block for minutes on the server 
side.
   
   Fix: #13020 
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. There is no API or property change. Property-only and comment-only alters
   avoid an unnecessary metastore stats update; all other alter behavior is
   unchanged.
   
   ### How was this patch tested?
   
   - Added a unit test `TestHiveCatalogOperations#testCanSkipStatsUpdate` 
covering
     the decision logic (property/comment-only changes skip stats; column 
changes
     and renames do not; empty/null changes fall back to the default).
   - Ran `./gradlew :catalogs:hive-metastore-common:test 
:catalogs:catalog-hive:test -PskipITs`
     and `spotlessApply`; all pass.
   


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