Skip to content

Commit c1b5a27

Browse files
authored
fix: change FileStorePathFactory::Create() to return shared_ptr (alibaba#352)
1 parent 3048ac4 commit c1b5a27

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/paimon/core/append/append_compact_coordinator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Status ValidateTable(const std::shared_ptr<TableSchema>& table_schema,
209209
}
210210

211211
/// Build FileStorePathFactory from core options and table schema.
212-
Result<std::unique_ptr<FileStorePathFactory>> BuildPathFactory(
212+
Result<std::shared_ptr<FileStorePathFactory>> BuildPathFactory(
213213
const std::string& table_path, const std::shared_ptr<TableSchema>& table_schema,
214214
const std::shared_ptr<arrow::Schema>& arrow_schema, const CoreOptions& core_options,
215215
const std::shared_ptr<MemoryPool>& pool) {

src/paimon/core/migrate/file_meta_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Result<std::unique_ptr<CommitMessage>> FileMetaUtils::GenerateCommitMessage(
148148

149149
// generate bucket path
150150
PAIMON_ASSIGN_OR_RAISE(
151-
std::unique_ptr<FileStorePathFactory> file_store_path_factory,
151+
std::shared_ptr<FileStorePathFactory> file_store_path_factory,
152152
FileStorePathFactory::Create(dst_table_path, schema, table_schema->PartitionKeys(),
153153
core_options.GetPartitionDefaultName(), format->Identifier(),
154154
core_options.DataFilePrefix(),

src/paimon/core/operation/expire_snapshots_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class ExpireSnapshotsTest : public testing::Test {
107107
return true;
108108
}
109109

110-
std::unique_ptr<FileStorePathFactory> CreateFactory(const std::string& root) const {
110+
std::shared_ptr<FileStorePathFactory> CreateFactory(const std::string& root) const {
111111
std::map<std::string, std::string> raw_options;
112112
raw_options[Options::FILE_FORMAT] = "orc";
113113
raw_options[Options::MANIFEST_FORMAT] = "orc";

src/paimon/core/utils/file_store_path_factory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ FileStorePathFactory::FileStorePathFactory(
5252
global_index_external_path_(global_index_external_path),
5353
index_file_in_data_file_dir_(index_file_in_data_file_dir) {}
5454

55-
Result<std::unique_ptr<FileStorePathFactory>> FileStorePathFactory::Create(
55+
Result<std::shared_ptr<FileStorePathFactory>> FileStorePathFactory::Create(
5656
const std::string& root, const std::shared_ptr<arrow::Schema>& schema,
5757
const std::vector<std::string>& partition_keys, const std::string& default_part_value,
5858
const std::string& identifier, const std::string& data_file_prefix,
@@ -70,7 +70,7 @@ Result<std::unique_ptr<FileStorePathFactory>> FileStorePathFactory::Create(
7070
std::unique_ptr<BinaryRowPartitionComputer> partition_computer,
7171
BinaryRowPartitionComputer::Create(partition_keys, schema, default_part_value,
7272
legacy_partition_name_enabled, memory_pool));
73-
return std::unique_ptr<FileStorePathFactory>(new FileStorePathFactory(
73+
return std::shared_ptr<FileStorePathFactory>(new FileStorePathFactory(
7474
root, identifier, data_file_prefix, uuid, std::move(partition_computer), external_paths,
7575
global_index_external_path, index_file_in_data_file_dir));
7676
}

src/paimon/core/utils/file_store_path_factory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class FileStorePathFactory : public std::enable_shared_from_this<FileStorePathFa
5050
public:
5151
static constexpr char BUCKET_PATH_PREFIX[] = "bucket-";
5252

53-
static Result<std::unique_ptr<FileStorePathFactory>> Create(
53+
static Result<std::shared_ptr<FileStorePathFactory>> Create(
5454
const std::string& root, const std::shared_ptr<arrow::Schema>& schema,
5555
const std::vector<std::string>& partition_keys, const std::string& default_part_value,
5656
const std::string& identifier, const std::string& data_file_prefix,

src/paimon/core/utils/file_store_path_factory_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class FileStorePathFactoryTest : public ::testing::Test {
4444
}
4545
void TearDown() override {}
4646

47-
std::unique_ptr<FileStorePathFactory> CreateFactory(const std::string& root) const {
47+
std::shared_ptr<FileStorePathFactory> CreateFactory(const std::string& root) const {
4848
arrow::FieldVector fields = {arrow::field("f0", arrow::boolean()),
4949
arrow::field("f1", arrow::int8()),
5050
arrow::field("f2", arrow::int8()),

0 commit comments

Comments
 (0)