From aa5cadfde2c87ef7e421f154d185fb8a246b0bf7 Mon Sep 17 00:00:00 2001 From: Sun Dapeng Date: Thu, 10 Sep 2026 02:02:40 +0800 Subject: [PATCH 1/3] [api][core] Add REST contract for resetting partition locations A null path in partitionOptions resets an existing Format Table partition to its default location, together with replacement statistics for that partition; non-null paths and statistics-only requests keep their behavior. --- docs/docs/concepts/rest/rest-api.md | 6 + docs/scripts/validate-rest-openapi.js | 17 +- docs/static/rest-catalog-open-api.yaml | 10 +- .../java/org/apache/paimon/rest/RESTApi.java | 8 +- .../requests/CreatePartitionsRequest.java | 74 +++- .../org/apache/paimon/catalog/Catalog.java | 5 + .../org/apache/paimon/rest/RESTCatalog.java | 8 +- .../CatalogFormatTablePartitionManager.java | 26 +- .../format/FormatTablePartitionManager.java | 6 +- .../paimon/rest/MockRESTCatalogTest.java | 385 +++++++++++++++++- .../apache/paimon/rest/RESTApiJsonTest.java | 92 ++++- .../rest/RESTCatalogPartitionSupport.java | 112 ++++- .../apache/paimon/rest/RESTCatalogServer.java | 13 +- ...atalogFormatTablePartitionManagerTest.java | 88 ++++ 14 files changed, 805 insertions(+), 45 deletions(-) diff --git a/docs/docs/concepts/rest/rest-api.md b/docs/docs/concepts/rest/rest-api.md index d7c211405843..6bdecb3d170a 100644 --- a/docs/docs/concepts/rest/rest-api.md +++ b/docs/docs/concepts/rest/rest-api.md @@ -30,6 +30,12 @@ order of `partitionSpecs`; use `{}` when a partition has no options. Custom loca `path` option. Before registering custom locations, ensure that the REST server supports partition options and all readers support custom locations. +For an existing Format Table partition, omitting `path` keeps its location, while `path: null` resets +the partition to its default directory under the table without deleting data and requires +`replaceStatistics=true` with a `partitionStatistics` entry for the same spec. A server that does not +support the reset rejects the request, as does any server that receives additive statistics for a +partition that already has a custom location. +