[core][spark] Support catalog-managed Format Table reads and writes - #8728
Closed
sundapeng wants to merge 1 commit into
Closed
[core][spark] Support catalog-managed Format Table reads and writes#8728sundapeng wants to merge 1 commit into
sundapeng wants to merge 1 commit into
Conversation
This was referenced Jul 19, 2026
Route managed Format Table partition discovery through the catalog so scans read exactly the registered partitions and an empty registration reads as empty instead of falling back to directory listing. Validate partition locations against the table path before any read or delete. Register written partitions at commit time in bounded batches, keep IF NOT EXISTS registration idempotent for concurrent writers, and fall back to unmanaged directory discovery when no catalog manages the table.
sundapeng
force-pushed
the
split-v4/format-table-managed-core
branch
from
July 19, 2026 11:43
d88608b to
da6aded
Compare
Member
Author
|
Closing in favour of a re-split of this work. The implementation changed enough since this split that updating the branch in
The review comments here are all addressed; the new PRs describe how. Replaced by: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relationship
First part of splitting #8713 into independently reviewable pieces (this PR is the
engine-independent foundation; the Spark DDL and administration parts follow in separate
PRs). The content is identical to the corresponding files of #8713.
Purpose
Follow-up of #8707 (catalog-managed Format Table partitions, REST contract + server side).
This PR makes the engine-independent client side actually use the managed partition
metadata: scans plan from the catalog instead of walking the directory tree, and batch
writes register the partitions they touched as part of the commit.
Main changes
Catalog#supportsManagedFormatTablePartitionscapability (default false; REST catalogreturns true), mirroring the existing capability-method pattern.
ManagedFormatTableScan: partitions come from paged catalog listing with apartition-name prefix pattern pushed down; no filesystem fallback. A registered
partition whose directory is missing reads as empty with a WARN (Hive semantics —
an
ADD PARTITIONbefore the first insert is a legitimate empty partition), while acatalog with no partitions but a non-empty table directory warns that a metadata sync
is needed. Catalog metadata is validated defensively (corrupt/duplicate specs).
FormatTableCommit: batch writes register touched partitions with the idempotentcreate contract, in batches of the catalog page size (one backfill commit can touch
tens of thousands of partitions). Registration failure fails the job; data files are
never silently dropped.
Format Tables and on the
engineimplementation atCREATE TABLEtime, with catalogtable-default.*options participating in the effective combination. Other catalogskeep treating the option as inert. Any table carrying the option where it cannot be
honored (other catalogs, external tables, later
ALTER ... SET) still loads,downgraded to unmanaged with a WARN, and can be repaired with
ALTER TABLE ... RESET/UNSET— there is deliberately no ALTER-time validationmachinery in this first version.
PartitionPathUtilshardening shared by the scan/discovery paths.Behavior notes reviewers should be aware of
generatePartitionPathUtilnow rejects null/emptypartition values (they cannot form a path component), and value-only spec extraction
unescapes directory names so specs round-trip with what writers register. Existing
tables with
%xx-escaped value-only directories will surface unescaped values.(invalidated on same-process mutations, including attempted-but-ambiguous ones).
Cross-JVM readers may observe metadata up to 30s stale; same-process reads are
immediately consistent.
empty registered partition is indistinguishable from an out-of-band directory
deletion, and Hive treats both as empty. Repair paths stay fail-closed (see the
administration part).
Tests
Core: managed scan (19), commit registration (7), catalog validation/fallback (core +
FileSystem/Jdbc/Hive/REST catalog suites, 354 tests in paimon-core plus 53 in
HiveCatalogTest), compatibility test pinning the Catalog binary surface, path-utils
tests. Spark write glue: batch write test.