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

Method MergeTreeMetaBase

src/MergeTreeCommon/MergeTreeMetaBase.cpp:114–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114MergeTreeMetaBase::MergeTreeMetaBase(
115 const StorageID & table_id_,
116 const String & relative_data_path_,
117 const StorageInMemoryMetadata & metadata_,
118 ContextMutablePtr context_,
119 const String & date_column_name,
120 const MergingParams & merging_params_,
121 std::unique_ptr<MergeTreeSettings> storage_settings_,
122 const String & logger_name_,
123 bool require_part_metadata_,
124 bool attach_,
125 BrokenPartCallback broken_part_callback_)
126 : IStorage(table_id_)
127 , WithMutableContext(context_->getGlobalContext())
128 , unique_key_index_cache(getContext()->getUniqueKeyIndexCache())
129 , merging_params(merging_params_)
130 , require_part_metadata(require_part_metadata_)
131 , broken_part_callback(broken_part_callback_)
132 , log_name(logger_name_)
133 , log(&Poco::Logger::get(log_name))
134 , storage_settings(std::move(storage_settings_))
135 , pinned_part_uuids(std::make_shared<PinnedPartUUIDs>())
136 , data_parts_by_info(data_parts_indexes.get<TagByInfo>())
137 , data_parts_by_state_and_info(data_parts_indexes.get<TagByStateAndInfo>())
138 , relative_data_path(relative_data_path_)
139{
140 const auto & settings = getSettings();
141 allow_nullable_key = attach_ || settings->allow_nullable_key || settings->enable_nullable_sorting_key;
142 if (!date_column_name.empty())
143 {
144 try
145 {
146 checkPartitionKeyAndInitMinMax(metadata_.partition_key);
147 if (minmax_idx_date_column_pos == -1)
148 throw Exception("Could not find Date column", ErrorCodes::BAD_TYPE_OF_FIELD);
149 }
150 catch (Exception & e)
151 {
152 /// Better error message.
153 e.addMessage("(while initializing MergeTree partition key from date column " + backQuote(date_column_name) + ")");
154 throw;
155 }
156 }
157 else
158 {
159 is_custom_partitioned = true;
160 checkPartitionKeyAndInitMinMax(metadata_.partition_key);
161 }
162
163 storage_address = fmt::format("{}", fmt::ptr(this));
164
165 /// NOTE: using the same columns list as is read when performing actual merges.
166 merging_params.check(metadata_, attach_);
167
168 if (metadata_.sampling_key.definition_ast != nullptr)
169 {
170 /// This is for backward compatibility.
171 checkSampleExpression(metadata_, getSettings()->compatibility_allow_sampling_expression_not_in_primary_key);

Callers

nothing calls this directly

Calls 9

backQuoteFunction · 0.85
addMessageMethod · 0.80
getFunction · 0.50
getSettingsFunction · 0.50
ExceptionClass · 0.50
getGlobalContextMethod · 0.45
emptyMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected