From 1305beb430d62b1958a6fdfd3134aaf8ffe79e05 Mon Sep 17 00:00:00 2001 From: Sun Dapeng Date: Thu, 3 Sep 2026 12:29:24 +0800 Subject: [PATCH 1/3] [api][rest] Support partition options in createPartitions --- docs/docs/concepts/rest/rest-api.md | 5 + docs/scripts/validate-rest-openapi.js | 42 ++ docs/static/rest-catalog-open-api.yaml | 18 + .../java/org/apache/paimon/rest/RESTApi.java | 7 +- .../requests/CreatePartitionsRequest.java | 46 +- .../apache/paimon/catalog/CachingCatalog.java | 10 +- .../org/apache/paimon/catalog/Catalog.java | 38 +- .../paimon/catalog/DelegateCatalog.java | 10 +- .../org/apache/paimon/rest/RESTCatalog.java | 87 ++- .../CatalogFormatTablePartitionManager.java | 5 +- .../FormatTablePartitionPathResolver.java | 507 +++++++++++++++++ ...FormatTablePartitionRegistryValidator.java | 67 +++ .../paimon/catalog/CachingCatalogTest.java | 31 +- .../paimon/catalog/DelegateCatalogTest.java | 27 +- .../paimon/rest/MockRESTCatalogTest.java | 420 +++++++++++++- .../apache/paimon/rest/RESTApiJsonTest.java | 64 +++ .../rest/RESTCatalogPartitionSupport.java | 189 +++++++ .../apache/paimon/rest/RESTCatalogServer.java | 95 +++- .../apache/paimon/rest/RESTCatalogTest.java | 11 +- ...atalogFormatTablePartitionManagerTest.java | 21 +- .../FormatTableCommitStatisticsTest.java | 3 +- .../table/format/FormatTableCommitTest.java | 7 +- .../FormatTablePartitionPathResolverTest.java | 516 ++++++++++++++++++ .../CatalogManagedPartitionAnalyzeTest.scala | 3 +- 24 files changed, 2150 insertions(+), 79 deletions(-) create mode 100644 paimon-core/src/main/java/org/apache/paimon/table/format/FormatTablePartitionPathResolver.java create mode 100644 paimon-core/src/main/java/org/apache/paimon/table/format/FormatTablePartitionRegistryValidator.java create mode 100644 paimon-core/src/test/java/org/apache/paimon/rest/RESTCatalogPartitionSupport.java create mode 100644 paimon-core/src/test/java/org/apache/paimon/table/format/FormatTablePartitionPathResolverTest.java diff --git a/docs/docs/concepts/rest/rest-api.md b/docs/docs/concepts/rest/rest-api.md index 8a2f2e69e0a5..d7c211405843 100644 --- a/docs/docs/concepts/rest/rest-api.md +++ b/docs/docs/concepts/rest/rest-api.md @@ -25,6 +25,11 @@ under the License. The OpenAPI 3.1 document below defines the language-neutral wire contract for REST Catalog servers and clients. It can also be used to generate or validate SDK models in other languages. +Partition options use the existing `POST .../partitions` request. `partitionOptions` follows the +order of `partitionSpecs`; use `{}` when a partition has no options. Custom locations use the +`path` option. Before registering custom locations, ensure that the REST server supports partition +options and all readers support custom locations. +