-
Notifications
You must be signed in to change notification settings - Fork 13
Allow any partition strategy to accept part export #1083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -279,6 +279,39 @@ String IMergeTreeDataPart::MinMaxIndex::getFileColumnName(const String & column_ | |
| return stream_name; | ||
| } | ||
|
|
||
| Block IMergeTreeDataPart::MinMaxIndex::getBlock(const MergeTreeData & data) const | ||
| { | ||
| if (!initialized) | ||
| throw Exception(ErrorCodes::LOGICAL_ERROR, "Attempt to get block from uninitialized MinMax index."); | ||
|
|
||
| Block block; | ||
|
|
||
| const auto metadata_snapshot = data.getInMemoryMetadataPtr(); | ||
| const auto & partition_key = metadata_snapshot->getPartitionKey(); | ||
|
|
||
| const auto minmax_column_names = data.getMinMaxColumnsNames(partition_key); | ||
| const auto minmax_column_types = data.getMinMaxColumnsTypes(partition_key); | ||
| const auto minmax_idx_size = minmax_column_types.size(); | ||
|
|
||
| for (size_t i = 0; i < minmax_idx_size; ++i) | ||
| { | ||
| const auto & data_type = minmax_column_types[i]; | ||
| const auto & column_name = minmax_column_names[i]; | ||
|
|
||
| const auto column = data_type->createColumn(); | ||
|
|
||
| const auto min_val = hyperrectangle.at(i).left; | ||
|
||
| const auto max_val = hyperrectangle.at(i).right; | ||
|
|
||
| column->insert(min_val); | ||
| column->insert(max_val); | ||
|
|
||
| block.insert(ColumnWithTypeAndName(column->getPtr(), data_type, column_name)); | ||
| } | ||
|
|
||
| return block; | ||
| } | ||
|
|
||
| void IMergeTreeDataPart::incrementStateMetric(MergeTreeDataPartState state_) const | ||
| { | ||
| switch (state_) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact: I copied this method from my first ClickHouse PR ever (or my second, I don't quite recall). This PR took over a year to be reviewed, and once merged, was reverted within a week :).
ClickHouse#39507