Skip to content

[core][spark] Support managed Format Table partition operations#8713

Closed
sundapeng wants to merge 1 commit into
apache:masterfrom
sundapeng:format-table-partition-operations
Closed

[core][spark] Support managed Format Table partition operations#8713
sundapeng wants to merge 1 commit into
apache:masterfrom
sundapeng:format-table-partition-operations

Conversation

@sundapeng

@sundapeng sundapeng commented Jul 18, 2026

Copy link
Copy Markdown
Member

Summary

Makes a REST catalog the source of truth for an internal Format Table's
partitions, opt in with TBLPROPERTIES ('metastore.partitioned-table' = 'true').
A scan reads the partitions registered in the catalog and a batch write
registers the ones it wrote; an unregistered directory is not part of the table,
and reads never fall back to the filesystem. Spark gets ADD/DROP PARTITION
and MSCK REPAIR TABLE on top.

This is the full view. It is split for review into:

Supersedes #8728, #8729, #8730, which reviewed an earlier shape.

Notes on the final shape

  • Reuses metastore.partitioned-table; a REST catalog already gates the
    partition API on it. A table is catalog-managed only when loading it produced
    a partition manager — an internal Format Table, in a REST catalog, under the
    paimon implementation — so nothing a Paimon table or a catalog default sets
    changes a Format Table by accident. Requesting it elsewhere fails the load
    rather than degrading silently.
  • No new SQL procedures; MSCK REPAIR TABLE is the reconcile entry point.

Testing

  • Core: 272 tests (partition manager, scan, commit, catalog assembly, path safety, REST)
  • Spark: 33 + 47 tests, including ALTER TABLE ... ADD PARTITION end to end and MSCK with fault injection
  • Scala 2.12 (JDK 11) and 2.13 (JDK 17) compile

@sundapeng sundapeng changed the title [core][spark] Support managed Format Table partition operations 【WIP】[core][spark] Support managed Format Table partition operations Jul 18, 2026
@sundapeng
sundapeng force-pushed the format-table-partition-operations branch from f2a9b50 to df367a3 Compare July 18, 2026 06:24
@sundapeng sundapeng changed the title 【WIP】[core][spark] Support managed Format Table partition operations [WIP][core][spark] Support managed Format Table partition operations Jul 18, 2026
@sundapeng sundapeng changed the title [WIP][core][spark] Support managed Format Table partition operations [core][spark] Support managed Format Table partition operations Jul 18, 2026
@sundapeng

Copy link
Copy Markdown
Member Author

To make this easier to review, I have split it into three stacked PRs with identical content (the tip of the stack is byte-identical to this branch):

Converting this PR to draft and keeping it open as the full-feature view; review can start with #8728. I will close this one once the split PRs are merged.

@sundapeng
sundapeng marked this pull request as draft July 19, 2026 07:46
@sundapeng
sundapeng force-pushed the format-table-partition-operations branch 5 times, most recently from f84a6d4 to 16e10a2 Compare July 20, 2026 15:51
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 format-table.partition-source=rest 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.

Spark gains the partition DDL this makes possible: ADD and DROP PARTITION,
and MSCK REPAIR TABLE to reconcile a table whose directories and catalog have
drifted apart — after a backfill by an older writer, say. DROP unregisters
before deleting, so a failed deletion leaves nothing readable behind, and a
repair never deletes data at all. SHOW PARTITIONS needs no special support:
it already asks the scan.

The option names one source and one only, so asking for it where it cannot be
served — outside a REST catalog, on an external table, under the engine
implementation — 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, so the engines cannot disagree about it.
@sundapeng

Copy link
Copy Markdown
Member Author

Core half merged as #8750. The remaining Spark half continues in #8751. Closing this full-view PR — nothing here is unaddressed by the two splits.

@sundapeng sundapeng closed this Jul 21, 2026
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.

1 participant