Stephen0421 opened a new pull request, #10062:
URL: https://github.com/apache/paimon/pull/10062

   ### Purpose
   
   Add Spark `CALL sys.expire_changelogs` so Spark can expire separated 
long-lived changelog files, matching the existing Flink procedure.
   
   The Spark procedure follows `expire_snapshots` rather than copying Flink's 
empty `ExpireConfig.builder()`:
   
   - Unspecified `retain_max` / `retain_min` / `older_than` / `max_deletes` 
fall back to table properties (`changelog.num-retained.*` / 
`changelog.time-retained`, or the corresponding `snapshot.*` options, and 
`snapshot.expire.limit` for `max_deletes`).
   - `options` can override table properties; explicit arguments override 
`options`.
   - Returns `deleted_changelogs_count INT`.
   - `delete_all` cannot be combined with `retain_max`, `retain_min`, 
`older_than`, `max_deletes`, or `options`.
   - Only `FileStoreTable` is supported.
   
   `retain_min` / `retain_max` are applied against the latest snapshot id, not 
the long-lived changelog count.
   
   `ExpireChangelogImpl.expireAll()` now returns `int` (changelog id range 
size, same contract as `expireUntil`). The method is documented as 
procedure-only; Flink/Spark are the only in-tree callers. Source-compatible 
(ignored return value still compiles), but binary-incompatible for any 
already-compiled external caller of `expireAll()`.
   
   Flink `expire_changelogs` is unchanged in this PR.
   
   ### Tests
   
   - [x] `ExpireChangelogsProcedureTest`: explicit args (`retain_max`, 
`older_than`, `max_deletes`, `retain_min`, `delete_all`) and result counts
   - [x] Empty `CALL` uses table properties (after `ALTER TABLE SET 
TBLPROPERTIES`)
   - [x] `options` overrides table properties
   - [x] No separated changelogs → `0`
   - [x] `retain_max < retain_min` throws `IllegalArgumentException`
   - [x] `delete_all` mixed with other arguments throws 
`IllegalArgumentException`


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