2019-06-18 12:54:27 +00:00
# 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>
2019-06-18 12:54:27 +00:00
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 " ;
2019-06-18 12:54:27 +00:00
}
IMergedBlockOutputStream : : IMergedBlockOutputStream (
2019-10-19 16:49:36 +00:00
const MergeTreeDataPartPtr & data_part ,
2019-06-18 12:54:27 +00:00
CompressionCodecPtr codec_ ,
2019-10-19 16:49:36 +00:00
const WriterSettings & writer_settings_ ,
2019-06-18 12:54:27 +00:00
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 ( ) )
2019-06-18 12:54:27 +00:00
, blocks_are_granules_size ( blocks_are_granules_size_ )
2019-10-19 16:49:36 +00:00
, index_granularity ( data_part - > index_granularity )
2019-06-18 12:54:27 +00:00
, 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 )
2019-06-18 12:54:27 +00:00
{
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.
}