Skip to content

[core] Parallelize per-partition file listing for catalog-managed format tables#8845

Open
XiaoHongbo-Hope wants to merge 8 commits into
apache:masterfrom
XiaoHongbo-Hope:format_table_parallel_scan
Open

[core] Parallelize per-partition file listing for catalog-managed format tables#8845
XiaoHongbo-Hope wants to merge 8 commits into
apache:masterfrom
XiaoHongbo-Hope:format_table_parallel_scan

Conversation

@XiaoHongbo-Hope

@XiaoHongbo-Hope XiaoHongbo-Hope commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

…mat tables

Format table split planning lists every partition's files serially, which is slow
for internal (catalog-managed) tables with many partitions (thousands of object
store LIST calls on the coordinator).

Extract the per-partition listing into a PartitionSplitPlanner strategy with two
implementations selected by the existing internal/external discriminator
(partitionManager != null):
- SequentialSplitPlanner (external): unchanged serial path; a missing partition
  directory is rethrown.
- ParallelSplitPlanner (internal): bounded, order-preserving fan-out via
  ManifestReadThreadPool; a registered partition without a directory reads as
  empty (matching Hive), any other listing failure fails the whole scan.

Split order and per-partition sort/bin-packing are unchanged, so output is
identical to the serial path. Parallelism is bounded by a new option
format-table.scan.list-parallelism (default #CPU); external tables are untouched.
}

/** Lists partition files and builds splits; per-partition sort and bin-packing are shared. */
private interface PartitionSplitPlanner {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

better to remove this interface

Inline the internal/external branch directly in splits(): a private
listPartitionFilesInParallel(...) for internal (catalog-managed) tables and the
serial loop for external tables. Behavior is unchanged.
@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as ready for review July 25, 2026 01:34
A non-positive format-table.scan.list-parallelism would create a
SemaphoredDelegatingExecutor with zero/negative permits, making the
listing acquire() block forever. Clamp to a minimum of 1 so a
misconfigured value degrades to serial listing instead of hanging.
BinaryRow partitionRow = toPartitionRow(partitionSpec);
if (partitionFilter == null || partitionFilter.test(partitionRow)) {
try {
if (partitionManager != null) {

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.

I think we could refactor the code here; the partitionManager should be renamed to SplitEnumerator so that it directly generates the corresponding Split.

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.

3 participants