Skip to content

[core][rest] Support catalog-managed partitions for Format Table reads and writes - #8750

Merged
JingsongLi merged 1 commit into
apache:masterfrom
sundapeng:split-v5/format-table-partition-source-core
Jul 21, 2026
Merged

[core][rest] Support catalog-managed partitions for Format Table reads and writes#8750
JingsongLi merged 1 commit into
apache:masterfrom
sundapeng:split-v5/format-table-partition-source-core

Conversation

@sundapeng

@sundapeng sundapeng commented Jul 20, 2026

Copy link
Copy Markdown
Member

Purpose

A partitioned Format Table discovers its partitions by listing the table
directory. This adds a second source for an internal Format Table in a REST
catalog, reusing the option that a REST catalog already uses to let it own a
Paimon table's partitions:

TBLPROPERTIES ('metastore.partitioned-table' = 'true')

The catalog then owns the partitions: a scan reads the ones registered there and
a batch write registers the ones it wrote. An unregistered directory is not part
of the table, and reads do not fall back to the filesystem. A registered
partition with no directory reads as empty, as in Hive.

metastore.partitioned-table keeps its meaning on a Paimon table (mirror
partitions into the metastore) and takes on this second one only for a Format
Table in a REST catalog, which is consistent — the REST server already gates the
partition API on it. The two never collide: a table is catalog-managed only when
loading it produced a partition manager, and that happens only for an internal
Format Table, in a REST catalog, under the paimon implementation. Everywhere else
the option keeps its existing meaning or is inert, so nothing a Paimon table or a
catalog default sets can change a Format Table by accident. Requesting it where it
cannot be served — a non-REST catalog, an external table,
format-table.implementation=engine — fails the load rather than reading
partitions from somewhere it did not ask for.

FormatTable carries a FormatTablePartitionManager holding a CatalogLoader;
it creates one catalog per operation and closes it, so the table stays
serializable. Paging and per-request batching are internal to it.

No REST protocol change: the endpoints and DTOs from #8707 are untouched.

Spark partition DDL follows in #8751. Splits #8713; supersedes #8728, #8729,
#8730.

Tests

CatalogUtilsTest, CatalogFormatTablePartitionManagerTest,
CatalogManagedPartitionScanTest, FormatTableCommitTest,
FormatTableCompatibilityTest, FileSystemCatalogTest, MockRESTCatalogTest,
PartitionPathUtilsTest — 272 tests.

@sundapeng sundapeng changed the title [core] Let a REST catalog own the partitions of a Format Table [core][rest] Support catalog-managed partitions for Format Table reads and writes Jul 20, 2026
@sundapeng
sundapeng force-pushed the split-v5/format-table-partition-source-core branch from 98d10d7 to 6111ecd Compare July 20, 2026 17:27
.withDescription("Format table uses paimon or engine.");

public static final ConfigOption<PartitionSource> FORMAT_TABLE_PARTITION_SOURCE =
key("format-table.partition-source")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not reusing partition metastore option?

@sundapeng
sundapeng force-pushed the split-v5/format-table-partition-source-core branch from 6111ecd to 423b9e0 Compare July 21, 2026 02:38
A partitioned Format Table finds its partitions by walking the table
directory. That is how Hive works and it stays the default, but it means a
directory appearing under the table is a partition, whether or not anyone
meant it to be, and that listing a large table costs a full traversal of
object storage.

With metastore.partitioned-table=true on an internal Format Table in a REST
catalog, the catalog becomes the source of truth instead: a scan reads the
partitions it has registered, and a batch write registers the ones it wrote.
A directory nobody registered is not part of the table, and an empty catalog
means an empty table — reads never quietly fall back to the filesystem, since
that would defeat the point. A registered partition whose directory is
missing reads as empty, matching Hive, where ADD PARTITION before the first
insert is ordinary.

The option already gates the catalog partition API for Paimon tables in a REST
catalog, so a Format Table using it for the same purpose is the same idea, not
a second one. On a Format Table it only takes effect in a REST catalog and only
for an internal table under the paimon implementation; asking for it elsewhere
fails rather than handing back a table reading its partitions from somewhere it
did not ask for. Whether a table's partitions come from the catalog is then
answered in one place, by whether loading it produced a partition manager.

The partition metadata itself is reached through a manager the table carries:
paging, per-request batching and pattern encoding are its business, and it
creates one catalog per operation and closes it, so the table stays
serializable without owning a client.

Engine support for the partition DDL this makes possible follows separately.
@sundapeng
sundapeng force-pushed the split-v5/format-table-partition-source-core branch from 423b9e0 to bc3cae9 Compare July 21, 2026 03:18
@JingsongLi
JingsongLi merged commit 983e745 into apache:master Jul 21, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants