lasdf1234 commented on issue #11699: URL: https://github.com/apache/gravitino/issues/11699#issuecomment-6758213360
Thanks for the proposal. **This looks already implemented** on current `main`, without adding a separate `system_iceberg_sort` built-in type. ### How it was implemented Sort / z-order rewrite is folded into the existing **`system_iceberg_compaction`** policy (`IcebergDataCompactionContent`) via two content fields: - `rewriteStrategy`: `binpack` (default) or `sort` - `sortOrder`: required when `rewriteStrategy` is `sort` (e.g. `zorder(c1,c2)` or a sort-order expression); must be empty for `binpack` Wiring: 1. Policy content validates the pair and puts `rewriteStrategy` / `sortOrder` into strategy `rules`. 2. `CompactionStrategyHandler` reads those rules and builds `CompactionJobContext`. 3. `GravitinoCompactionJobAdapter` maps them to the existing `builtin-iceberg-rewrite-data-files` job as Iceberg procedure args `strategy` / `sort_order`. So TMS can already schedule sorted rewrites with the same policy type + handler + job path as binpack compaction; no new `Policy.BuiltInType`, `SortStrategyHandler`, or job class is required for the original end-to-end ask. Landed in: https://github.com/apache/gravitino/pull/13727 (`[#13726] feat(policy): Support Iceberg rewrite strategy and sort order`). ### Example shape ```json { "policyType": "system_iceberg_compaction", "content": { "rewriteStrategy": "sort", "sortOrder": "zorder(c1,c2)", "rewriteOptions": { "min-input-files": "5" } } } ``` ### Remaining gap (optional follow-up) Trigger / score expressions are still the compaction MSE / delete-file ones, not a dedicated “table is unsorted” signal. If we later want sort-specific recommendation semantics or a structured sort-order schema, that can be a smaller follow-up — but a separate `system_iceberg_sort` policy type does not seem necessary now. Suggest closing this issue as completed by #13727 (unless we want to keep it open only for sort-specific triggers/docs). -- 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]
