refactor(fs): make FileStatus and BasicFileStatus concrete value types - #208
Merged
Conversation
lxy-9602
reviewed
Aug 17, 2026
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.
refactor(fs): make FileStatus and BasicFileStatus concrete value types
Purpose
Linked issue: close #xxx
FileStatusandBasicFileStatuswere pure-virtual interfaces with onesubclass per file system implementation (Local/Jindo/ObjectStore/Mock),
forcing a heap allocation per entry on every
GetFileStatus/ListFileStatus/ListDircall. None of the subclasses added anybehavior or extra state beyond
path/length/is_dir/modification_time, so the polymorphism was not pulling its weight.This change turns both classes into concrete value types (similar to
arrow::fs::FileInfo):FileStatusholds path, length, is_dir and modification_time; allvirtual methods (including the destructor) are removed.
BasicFileStatusholds path and is_dir; all virtual methods are removed.FileSystem::GetFileStatusnow returnsResult<FileStatus>;ListFileStatusfillsstd::vector<FileStatus>*;ListDirfillsstd::vector<BasicFileStatus>*.LocalFileStatus,JindoFileStatus,ObjectStoreFileStatus,MockFileStatus) and three basic subclasses(
LocalBasicFileStatus,JindoBasicFileStatus,ObjectStoreBasicFileStatus) are deleted;local_file_status.handjindo_file_status.hare removed.JdoFileInfoto paimon types eagerly instead of lazilywrapping it.
No behavioral semantics change: unknown modification time still reports
kUnknownModificationTime, directory semantics are unchanged, andListDirstill returns basic information only.Tests
No new cases added; existing coverage exercises the changed paths:
file_system_test.cpp(ListDir / GetFileStatus / ListFileStatus forlocal and object store),
object_store_file_system_test.cpp,resolving_file_system_test.cpp,jindo_file_system_test.cpporphan_files_cleaner,file_store_commit_impl(gmockFileSystem),
snapshot_manager,manifest_file,merge_tree_writer,lookup_levels,append_only_writer,commit_message, etc.API and Format
Yes, this is a breaking C++ API change in
include/paimon/fs/file_system.h:FileStatus/BasicFileStatusare no longer polymorphic and cannotbe subclassed; they are now passed by value.
FileSystem::GetFileStatussignature changes fromResult<std::unique_ptr<FileStatus>>toResult<FileStatus>;ListFileStatusandListDirout-parameters change fromstd::vector<std::unique_ptr<...>>*tostd::vector<...>*.FileSystemimplementations must update their overrides.No effect on storage format or wire protocol.
Documentation
No new feature; only class doc comments were updated to reflect value
semantics.
Generative AI tooling
Generated-by: Qoder