MCPcopy Create free account
hub / github.com/ByConity/ByConity / createPartWrapperFromModelBasic

Function createPartWrapperFromModelBasic

src/Protos/DataModelHelpers.cpp:75–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75DataModelPartWrapperPtr createPartWrapperFromModelBasic(const Protos::DataModelPart && part_model, const String && part_name)
76{
77 DataModelPartWrapperPtr part_model_wrapper = std::make_shared<DataModelPartWrapper>();
78
79 part_model_wrapper->info = createPartInfoFromModel(part_model.part_info());
80 if (part_name.empty())
81 part_model_wrapper->name = part_model_wrapper->info->getPartName();
82 else
83 part_model_wrapper->name = std::move(part_name);
84
85 part_model_wrapper->part_model = std::make_shared<Protos::DataModelPart>(std::move(part_model));
86 auto & inside_part_model = *(part_model_wrapper->part_model);
87 if (!inside_part_model.has_deleted())
88 inside_part_model.set_deleted(false);
89 if (!inside_part_model.has_data_path_id())
90 inside_part_model.set_data_path_id(0);
91 if (!inside_part_model.has_mutation_commit_time())
92 inside_part_model.set_mutation_commit_time(0);
93 if (!inside_part_model.has_commit_time())
94 inside_part_model.set_commit_time(part_model_wrapper->info->mutation);
95
96 if (inside_part_model.has_min_unique_key() && inside_part_model.min_unique_key().empty() && inside_part_model.rows_count() > 0)
97 throw Exception("min unique key of non empty part must be non empty", ErrorCodes::LOGICAL_ERROR);
98 if (inside_part_model.has_max_unique_key() && inside_part_model.max_unique_key().empty() && inside_part_model.rows_count() > 0)
99 throw Exception("max unique key of non empty part must be non empty", ErrorCodes::LOGICAL_ERROR);
100
101 return part_model_wrapper;
102}
103
104MutableMergeTreeDataPartCNCHPtr
105createPartFromModelCommon(const MergeTreeMetaBase & storage, const Protos::DataModelPart & part_model, std::optional<String> relative_path)

Callers 1

Calls 4

createPartInfoFromModelFunction · 0.85
getPartNameMethod · 0.80
ExceptionClass · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected