@@ -44,6 +44,7 @@ class PAIMON_EXPORT WriteContext {
4444 const std::vector<std::string>& write_schema,
4545 const std::shared_ptr<MemoryPool>& memory_pool,
4646 const std::shared_ptr<Executor>& executor,
47+ const std::shared_ptr<FileSystem>& specific_file_system,
4748 const std::map<std::string, std::string>& fs_scheme_to_identifier_map,
4849 const std::map<std::string, std::string>& options);
4950
@@ -97,6 +98,10 @@ class PAIMON_EXPORT WriteContext {
9798 return executor_;
9899 }
99100
101+ std::shared_ptr<FileSystem> GetSpecificFileSystem () const {
102+ return specific_file_system_;
103+ }
104+
100105 private:
101106 std::string root_path_;
102107 std::string commit_user_;
@@ -108,6 +113,7 @@ class PAIMON_EXPORT WriteContext {
108113 std::vector<std::string> write_schema_;
109114 std::shared_ptr<MemoryPool> memory_pool_;
110115 std::shared_ptr<Executor> executor_;
116+ std::shared_ptr<FileSystem> specific_file_system_;
111117 std::map<std::string, std::string> fs_scheme_to_identifier_map_;
112118 std::map<std::string, std::string> options_;
113119};
@@ -175,12 +181,30 @@ class PAIMON_EXPORT WriteContextBuilder {
175181 // / @return Reference to this builder for method chaining.
176182 WriteContextBuilder& WithWriteSchema (const std::vector<std::string>& write_schema);
177183
178- // / Set the file system scheme to identifier mapping for custom file system configurations.
179- // / This allows using different file system implementations for different URI schemes.
184+ // / Sets a custom file system instance to be used for all file operations in this write context.
185+ // / This bypasses the global file system registry and uses the provided implementation directly.
186+ // /
187+ // / @param file_system The file system to use.
188+ // / @return Reference to this builder for method chaining.
189+ // / @note If not set, use default file system (configured in `Options::FILE_SYSTEM`)
190+ WriteContextBuilder& WithFileSystem (const std::shared_ptr<FileSystem>& file_system);
191+
192+ // / Sets a mapping from URI schemes (e.g., "file", "oss") to registered file system
193+ // / identifiers. This allows selecting different pre-registered file system implementations
194+ // / based on the URI scheme at runtime.
180195 // /
181- // / @param fs_scheme_to_identifier_map Map from URI scheme to file system identifier.
196+ // / @param fs_scheme_to_identifier_map Map from URI scheme (like "oss") to the corresponding
197+ // / file system identifier.
182198 // / @return Reference to this builder for method chaining.
183- // / @note If not set, use default file system (configured in `Options::FILE_SYSTEM`).
199+ // / @note
200+ // / - This method is intended for environments where multiple file systems are pre-registered.
201+ // / - The specified identifiers must correspond to file systems that have been registered at
202+ // / compile time or initialization.
203+ // / - Cannot be used together with `WithFileSystem()`.
204+ // / - If not set, use default file system (configured in `Options::FILE_SYSTEM`).
205+ // / Example:
206+ // / builder.WithFileSystemSchemeToIdentifierMap({{"oss", "jindo"}, {"file", "local"}});
207+ // /
184208 WriteContextBuilder& WithFileSystemSchemeToIdentifierMap (
185209 const std::map<std::string, std::string>& fs_scheme_to_identifier_map);
186210
0 commit comments