lszskye commented on code in PR #516:
URL: https://github.com/apache/paimon-cpp/pull/516#discussion_r4488730535
##########
src/paimon/core/table/table.cpp:
##########
@@ -1383,55 +1324,29 @@ Result<std::unique_ptr<FileStoreCommit>>
FileStoreCommit::Create(
return Status::NotImplemented(
"commit operation does not support object store file system for
now");
}
+ FileStore file_store(root_path, branch, options);
PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<BinaryRowPartitionComputer>
partition_computer,
-
BinaryRowPartitionComputer::Create(schema->PartitionKeys(), arrow_schema,
-
options.GetPartitionDefaultName(),
-
options.LegacyPartitionNameEnabled(),
-
ctx->GetMemoryPool()));
- PAIMON_ASSIGN_OR_RAISE(std::vector<std::string> external_paths,
options.CreateExternalPaths());
- PAIMON_ASSIGN_OR_RAISE(std::optional<std::string>
global_index_external_path,
- options.CreateGlobalIndexExternalPath());
-
+ file_store.NewPartitionComputer(arrow_schema,
schema->PartitionKeys(),
+
ctx->GetMemoryPool()));
PAIMON_ASSIGN_OR_RAISE(
std::shared_ptr<FileStorePathFactory> path_factory,
- FileStorePathFactory::Create(
- root_path, arrow_schema, schema->PartitionKeys(),
options.GetPartitionDefaultName(),
- options.GetFileFormat()->Identifier(), options.DataFilePrefix(),
- options.LegacyPartitionNameEnabled(), external_paths,
global_index_external_path,
- options.IndexFileInDataFileDir(), ctx->GetMemoryPool()));
-
- auto snapshot_manager =
- std::make_shared<SnapshotManager>(options.GetFileSystem(), root_path,
branch);
- if (IsCatalogCommit(*ctx)) {
- std::shared_ptr<Catalog> catalog = ctx->GetCatalog();
- VersionManagedCatalog* versioned = AsVersionManaged(catalog);
- Identifier identifier = catalog_identifier.value();
- // Capture the catalog to keep the versioned interface alive.
- snapshot_manager->SetSnapshotLoader(
- [catalog, versioned, identifier]() ->
Result<std::optional<Snapshot>> {
- return versioned->LoadSnapshot(identifier);
- });
- }
+ file_store.NewPathFactory(arrow_schema, schema->PartitionKeys(),
+ options.GetFileFormat()->Identifier(),
ctx->GetMemoryPool()));
PAIMON_ASSIGN_OR_RAISE(
- std::shared_ptr<ManifestList> manifest_list,
- ManifestList::Create(options.GetFileSystem(),
options.GetManifestFormat(),
- options.GetManifestCompression(), path_factory,
options.GetCache(),
- ctx->GetMemoryPool()));
-
+ std::shared_ptr<SnapshotManager> snapshot_manager,
+ file_store.NewSnapshotManager(IsCatalogCommit(*ctx) ?
ctx->GetCatalog() : nullptr,
+ catalog_identifier));
Review Comment:
The IsCatalogCommit(*ctx) check seems redundant here, since
NewSnapshotManager() already checks AsVersionManaged(catalog) internally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]