load only required partitions for the table when partition filter is …#76
Open
vamsikarnika wants to merge 1 commit into
Open
load only required partitions for the table when partition filter is …#76vamsikarnika wants to merge 1 commit into
vamsikarnika wants to merge 1 commit into
Conversation
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.
Description
Scope Hudi file system view loading to the set of pruned partitions instead of always loading every partition. When the Hudi metadata table is enabled,
HudiSnapshotDirectoryListerpreviously calledHoodieTableFileSystemView.loadAllPartitions()once per query, regardless of how many partitions actually matched the query predicate. For selective queries on tables with many partitions this dominates split-generation time.This change introduces an opt-in session property
scope_fsv_to_pruned_partitions(and matching confighudi.metadata.scope-fsv-to-pruned-partitions, defaultfalse) that switches the call toloadPartitions(prunedPaths), whereprunedPathsis the set of partitions that survived partition pruning inHudiBackgroundSplitLoader. Behavior is unchanged when the flag is off.Mechanically:
HudiBackgroundSplitLoader.generateSplitsnow publishes the pruned relative partition paths to the directory lister immediately aftergetPartitionInfos(), before any worker thread is submitted.HudiSnapshotDirectoryListerreads the session flag at construction and, if both the flag is enabled and pruned paths have been set when the lazy file system view initializes, callsloadPartitions(...)instead ofloadAllPartitions(). If the paths have not been set for any reason, it falls back to the existingloadAllPartitions()behavior.HudiDirectoryListergains a default no-opsetPrunedPartitionPaths(List<String>)method, so the split loader can publish the paths without aninstanceofcheck and without forcing other implementations to implement the hint.The "Created file system view of table" log line now includes the pruned partition count when scoped loading is in effect, so the new path is easy to identify in the coordinator logs.
Additional context and related issues
In benchmarks against a Hudi 1.0 table with 365 partitions where the query predicate matched only 31 partitions,
loadAllPartitions()accounted for roughly 85–90% of split-generation time (~5s on a 500k-row table, ~9s on a 1M-row table). The cost scales with total partition count and total file count in the metadata tablefilespartition, not with the size of the pruned set, because the call eagerly materializes every partition's file slices through the metadata-backed file system view.HoodieTableFileSystemView.loadPartitions(List<String>)is part of the publicTableFileSystemViewinterface and is implemented by bothAbstractTableFileSystemViewandRemoteHoodieTableFileSystemView, so this change is portable across the file system view backends Hudi exposes.The flag is intentionally off by default so existing deployments see no change. Once it has been validated in production-like workloads it can be promoted to the default. The non-metadata-table path (
hudi.metadata-enabled=false) is untouched.Other follow-ups that came out of the same investigation but are not part of this PR:
(table, latestCommitTime)so repeat queries skip FSV creation entirely.HoodieLocalEngineContextwith a parallel engine context so Hudi's internalengineContext.parallelize(...)calls inloadPartitionscan actually parallelize HFile reads from the metadata table.Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: