agnes-xinyi-lu opened a new pull request, #13453:
URL: https://github.com/apache/gravitino/pull/13453

   <!--
   1. Title: [#<issue>] <type>(<scope>): <subject>
      Examples:
        - "[#123] feat(operator): Support xxx"
        - "[#233] fix: Check null before access result in xxx"
        - "[MINOR] refactor: Fix typo in variable name"
        - "[MINOR] docs: Fix typo in README"
        - "[#255] test: Fix flaky test NameOfTheTest"
      Reference: https://www.conventionalcommits.org/en/v1.0.0/
   2. If the PR is unfinished, please mark this PR as draft.
   -->
   
   ### What changes were proposed in this pull request?
   Call `discardChanges()` in `IcebergTableOperations.filterSnapshotsByRefs` 
after
   `suppressHistoricalSnapshots()` and before `build()`.
   
   ### Why are the changes needed?
   `suppressHistoricalSnapshots()` also removes the statistics and partition 
statistics
   attached to the suppressed snapshots, and records those removals as 
`MetadataUpdate`
   changes on the builder. `TableMetadata.Builder.build()` refuses to set a 
metadata
   location while changes are pending, so `GET 
.../tables/{table}?snapshots=refs` fails with
   
       IllegalArgumentException: Cannot set metadata location with changes to 
table metadata: N changes
   
   for any table whose unreferenced snapshots carry statistics (e.g. tables 
written by
   Trino, which attaches statistics on every INSERT). This surfaced after 
#13290 started
   setting the metadata location explicitly. The filtered metadata is a 
read-only view of
   the table, not a commit, so the response must not carry pending updates.
   
   Fix: #13452 
   
   ### Does this PR introduce _any_ user-facing change?
   no
   (Please list the user-facing changes introduced by your change, including
     1. Change in user-facing APIs.
     2. Addition or removal of property keys.)
   
   ### How was this patch tested?
   UT
   


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