ClickHouse/dbms/src/Storages/MergeTree/IMergedBlockOutputStream.cpp

47 lines
1.6 KiB
C++
Raw Normal View History

#include <Storages/MergeTree/IMergedBlockOutputStream.h>
#include <IO/createWriteBufferFromFileBase.h>
2019-10-19 16:49:36 +00:00
#include <Storages/MergeTree/MergeTreeReaderSettings.h>
2019-10-21 15:33:59 +00:00
#include <Storages/MergeTree/IMergeTreeDataPartWriter.h>
namespace DB
{
namespace ErrorCodes
{
extern const int LOGICAL_ERROR;
}
namespace
{
2019-10-21 15:33:59 +00:00
// constexpr auto DATA_FILE_EXTENSION = ".bin";
2019-07-28 11:10:35 +00:00
constexpr auto INDEX_FILE_EXTENSION = ".idx";
}
IMergedBlockOutputStream::IMergedBlockOutputStream(
2019-10-19 16:49:36 +00:00
const MergeTreeDataPartPtr & data_part,
CompressionCodecPtr codec_,
2019-10-19 16:49:36 +00:00
const WriterSettings & writer_settings_,
bool blocks_are_granules_size_,
2019-07-28 11:10:35 +00:00
const std::vector<MergeTreeIndexPtr> & indices_to_recalc,
2019-10-19 16:49:36 +00:00
bool can_use_adaptive_granularity_)
: storage(data_part->storage)
, part_path(data_part->getFullPath())
, writer_settings(writer_settings_)
, can_use_adaptive_granularity(can_use_adaptive_granularity_)
2019-10-28 11:00:29 +00:00
, marks_file_extension(data_part->getMarksFileExtension())
, blocks_are_granules_size(blocks_are_granules_size_)
2019-10-19 16:49:36 +00:00
, index_granularity(data_part->index_granularity)
, compute_granularity(index_granularity.empty())
, codec(std::move(codec_))
2019-07-28 11:10:35 +00:00
, skip_indices(indices_to_recalc)
2019-08-26 14:24:29 +00:00
, with_final_mark(storage.getSettings()->write_final_mark && can_use_adaptive_granularity)
{
if (blocks_are_granules_size && !index_granularity.empty())
throw Exception("Can't take information about index granularity from blocks, when non empty index_granularity array specified", ErrorCodes::LOGICAL_ERROR);
}
/// Implementation of IMergedBlockOutputStream::ColumnStream.
}