mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-06 08:30:54 +00:00
polymorphic parts (development) cleanup
This commit is contained in:
parent
55b7db716a
commit
6f673407ff
@ -7,7 +7,6 @@ namespace DB
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// constexpr auto DATA_FILE_EXTENSION = ".bin";
|
|
||||||
constexpr auto INDEX_FILE_EXTENSION = ".idx";
|
constexpr auto INDEX_FILE_EXTENSION = ".idx";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <IO/HashingWriteBuffer.h>
|
#include <IO/HashingWriteBuffer.h>
|
||||||
#include <Storages/MergeTree/MergeTreeData.h>
|
#include <Storages/MergeTree/MergeTreeData.h>
|
||||||
#include <DataStreams/IBlockOutputStream.h>
|
#include <DataStreams/IBlockOutputStream.h>
|
||||||
// #include <Storages/MergeTree/MergeTreeData.h>
|
|
||||||
#include <Storages/MergeTree/IMergeTreeDataPart.h>
|
#include <Storages/MergeTree/IMergeTreeDataPart.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Class contains information about index granularity in rows ofIMergeTreeDataPart
|
/// Class contains information about index granularity in rows of MergeTreeDataPart
|
||||||
/// Inside it contains vector of partial sums of rows after mark:
|
/// Inside it contains vector of partial sums of rows after mark:
|
||||||
/// |-----|---|----|----|
|
/// |-----|---|----|----|
|
||||||
/// | 5 | 8 | 12 | 16 |
|
/// | 5 | 8 | 12 | 16 |
|
||||||
|
@ -81,4 +81,30 @@ void MergeTreeIndexGranularityInfo::setNonAdaptive()
|
|||||||
index_granularity_bytes = 0;
|
index_granularity_bytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getAdaptiveMrkExtension(MergeTreeDataPartType part_type)
|
||||||
|
{
|
||||||
|
switch(part_type)
|
||||||
|
{
|
||||||
|
case MergeTreeDataPartType::WIDE:
|
||||||
|
return ".mrk2";
|
||||||
|
case MergeTreeDataPartType::COMPACT:
|
||||||
|
return ".mrk3";
|
||||||
|
default:
|
||||||
|
throw Exception("Unknown part type", ErrorCodes::UNKNOWN_PART_TYPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t getAdaptiveMrkSize(MergeTreeDataPartType part_type, size_t columns_num)
|
||||||
|
{
|
||||||
|
switch(part_type)
|
||||||
|
{
|
||||||
|
case MergeTreeDataPartType::WIDE:
|
||||||
|
return sizeof(UInt64) * 3;
|
||||||
|
case MergeTreeDataPartType::COMPACT:
|
||||||
|
return sizeof(UInt64) * (columns_num * 2 + 1);
|
||||||
|
default:
|
||||||
|
throw Exception("Unknown part type", ErrorCodes::UNKNOWN_PART_TYPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,30 +63,7 @@ private:
|
|||||||
constexpr inline auto getNonAdaptiveMrkExtension() { return ".mrk"; }
|
constexpr inline auto getNonAdaptiveMrkExtension() { return ".mrk"; }
|
||||||
constexpr inline auto getNonAdaptiveMrkSize() { return sizeof(MarkInCompressedFile) * 2; }
|
constexpr inline auto getNonAdaptiveMrkSize() { return sizeof(MarkInCompressedFile) * 2; }
|
||||||
|
|
||||||
inline std::string getAdaptiveMrkExtension(MergeTreeDataPartType part_type)
|
std::string getAdaptiveMrkExtension(MergeTreeDataPartType part_type);
|
||||||
{
|
size_t getAdaptiveMrkSize(MergeTreeDataPartType part_type, size_t columns_num);
|
||||||
switch(part_type)
|
|
||||||
{
|
|
||||||
case MergeTreeDataPartType::WIDE:
|
|
||||||
return ".mrk2";
|
|
||||||
case MergeTreeDataPartType::COMPACT:
|
|
||||||
return ".mrk3";
|
|
||||||
default:
|
|
||||||
throw Exception("Unknown part type", ErrorCodes::UNKNOWN_PART_TYPE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline size_t getAdaptiveMrkSize(MergeTreeDataPartType part_type, size_t columns_num)
|
|
||||||
{
|
|
||||||
switch(part_type)
|
|
||||||
{
|
|
||||||
case MergeTreeDataPartType::WIDE:
|
|
||||||
return sizeof(UInt64) * 3;
|
|
||||||
case MergeTreeDataPartType::COMPACT:
|
|
||||||
return sizeof(UInt64) * (columns_num * 2 + 1);
|
|
||||||
default:
|
|
||||||
throw Exception("Unknown part type", ErrorCodes::UNKNOWN_PART_TYPE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ bool MergeTreePartsMover::selectPartsForMove(
|
|||||||
const AllowedMovingPredicate & can_move,
|
const AllowedMovingPredicate & can_move,
|
||||||
const std::lock_guard<std::mutex> & /* moving_parts_lock */)
|
const std::lock_guard<std::mutex> & /* moving_parts_lock */)
|
||||||
{
|
{
|
||||||
auto data_parts = data->getDataPartsVector();
|
MergeTreeData::DataPartsVector data_parts = data->getDataPartsVector();
|
||||||
|
|
||||||
if (data_parts.empty())
|
if (data_parts.empty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -33,7 +33,7 @@ MergeTreeReadPool::MergeTreeReadPool(
|
|||||||
for (auto & part_ranges : parts_ranges)
|
for (auto & part_ranges : parts_ranges)
|
||||||
std::reverse(std::begin(part_ranges.ranges), std::end(part_ranges.ranges));
|
std::reverse(std::begin(part_ranges.ranges), std::end(part_ranges.ranges));
|
||||||
|
|
||||||
/// parts don't contain duplicateIMergeTreeDataPart's.
|
/// parts don't contain duplicate MergeTreeDataPart's.
|
||||||
const auto per_part_sum_marks = fillPerPartInfo(parts_, check_columns_);
|
const auto per_part_sum_marks = fillPerPartInfo(parts_, check_columns_);
|
||||||
fillPerThreadInfo(threads_, sum_marks_, per_part_sum_marks, parts_, min_marks_for_concurrent_read_);
|
fillPerThreadInfo(threads_, sum_marks_, per_part_sum_marks, parts_, min_marks_for_concurrent_read_);
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,7 @@ private:
|
|||||||
|
|
||||||
void initMarksLoader();
|
void initMarksLoader();
|
||||||
void seekToStart();
|
void seekToStart();
|
||||||
void seekToMark(size_t row, size_t col);
|
void seekToMark(size_t row_index, size_t column_index);
|
||||||
const MarkInCompressedFile & getMark(size_t row, size_t col);
|
|
||||||
|
|
||||||
void readData(const String & name, const IDataType & type, IColumn & column,
|
void readData(const String & name, const IDataType & type, IColumn & column,
|
||||||
size_t from_mark, size_t column_position, size_t rows_to_read);
|
size_t from_mark, size_t column_position, size_t rows_to_read);
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#include <Core/Block.h>
|
|
||||||
|
|
||||||
namespace DB
|
|
||||||
{
|
|
||||||
|
|
||||||
class MergeTreeWriter
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
using MergeTreeWriterPtr = std::shared_ptr<MergeTreeWriter>;
|
|
||||||
|
|
||||||
}
|
|
@ -307,6 +307,7 @@ void StorageMergeTree::alter(
|
|||||||
|
|
||||||
context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, new_constraints, storage_modifier);
|
context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, new_constraints, storage_modifier);
|
||||||
|
|
||||||
|
|
||||||
/// Reinitialize primary key because primary key column types might have changed.
|
/// Reinitialize primary key because primary key column types might have changed.
|
||||||
setProperties(new_order_by_ast, new_primary_key_ast, new_columns, new_indices, new_constraints);
|
setProperties(new_order_by_ast, new_primary_key_ast, new_columns, new_indices, new_constraints);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user