2013-04-24 10:31:32 +00:00
# pragma once
2013-05-03 10:20:53 +00:00
# include <DB/DataStreams/IProfilingBlockInputStream.h>
2014-03-09 17:36:01 +00:00
# include <DB/Storages/MergeTree/MergeTreeData.h>
2013-05-03 10:20:53 +00:00
# include <DB/Storages/MergeTree/PKCondition.h>
2013-11-26 11:55:11 +00:00
# include <DB/Storages/MergeTree/MergeTreeReader.h>
2016-07-21 16:22:24 +00:00
# include <DB/Columns/ColumnNullable.h>
2013-09-08 05:53:10 +00:00
2013-04-24 10:31:32 +00:00
namespace DB
{
2016-01-11 21:46:36 +00:00
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER ;
}
2013-04-24 10:31:32 +00:00
/// Для чтения из одного куска. Для чтения сразу из многих, Storage использует сразу много таких объектов.
class MergeTreeBlockInputStream : public IProfilingBlockInputStream
{
public :
MergeTreeBlockInputStream ( const String & path_ , /// Путь к куску
2014-07-17 13:41:47 +00:00
size_t block_size_ , Names column_names ,
2014-03-09 17:36:01 +00:00
MergeTreeData & storage_ , const MergeTreeData : : DataPartPtr & owned_data_part_ ,
2014-03-19 10:45:13 +00:00
const MarkRanges & mark_ranges_ , bool use_uncompressed_cache_ ,
2015-04-12 04:39:20 +00:00
ExpressionActionsPtr prewhere_actions_ , String prewhere_column_ , bool check_columns ,
2015-12-26 00:59:09 +00:00
size_t min_bytes_to_use_direct_io_ , size_t max_read_buffer_size_ ,
bool save_marks_in_cache_ )
2014-03-19 10:45:13 +00:00
:
2014-07-17 13:41:47 +00:00
path ( path_ ) , block_size ( block_size_ ) ,
2013-09-08 05:53:10 +00:00
storage ( storage_ ) , owned_data_part ( owned_data_part_ ) ,
2014-07-14 14:07:47 +00:00
part_columns_lock ( new Poco : : ScopedReadRWLock ( owned_data_part - > columns_lock ) ) ,
2013-11-26 11:55:11 +00:00
all_mark_ranges ( mark_ranges_ ) , remaining_mark_ranges ( mark_ranges_ ) ,
2013-12-02 12:15:39 +00:00
use_uncompressed_cache ( use_uncompressed_cache_ ) ,
2014-03-13 12:48:07 +00:00
prewhere_actions ( prewhere_actions_ ) , prewhere_column ( prewhere_column_ ) ,
2015-02-16 17:01:38 +00:00
log ( & Logger : : get ( " MergeTreeBlockInputStream " ) ) ,
2015-04-12 04:39:20 +00:00
ordered_names { column_names } ,
2015-12-26 00:59:09 +00:00
min_bytes_to_use_direct_io ( min_bytes_to_use_direct_io_ ) , max_read_buffer_size ( max_read_buffer_size_ ) ,
save_marks_in_cache ( save_marks_in_cache_ )
2013-04-24 10:31:32 +00:00
{
2016-03-30 19:59:43 +00:00
try
2014-04-22 22:52:00 +00:00
{
2016-03-30 19:59:43 +00:00
/** @note можно было бы просто поменять местами reverse в if и else ветках MergeTreeDataSelectExecutor,
* а э т о т reverse у б р а т ь . */
std : : reverse ( remaining_mark_ranges . begin ( ) , remaining_mark_ranges . end ( ) ) ;
/// inject columns required for defaults evaluation
const auto injected_columns = injectRequiredColumns ( column_names ) ;
should_reorder = ! injected_columns . empty ( ) ;
Names pre_column_names ;
if ( prewhere_actions )
{
pre_column_names = prewhere_actions - > getRequiredColumns ( ) ;
if ( pre_column_names . empty ( ) )
pre_column_names . push_back ( column_names [ 0 ] ) ;
const auto injected_pre_columns = injectRequiredColumns ( pre_column_names ) ;
if ( ! injected_pre_columns . empty ( ) )
should_reorder = true ;
const NameSet pre_name_set ( pre_column_names . begin ( ) , pre_column_names . end ( ) ) ;
/// Если выражение в PREWHERE - не столбец таблицы, не нужно отдавать наружу столбец с ним
/// (от storage ожидают получить только столбцы таблицы).
remove_prewhere_column = ! pre_name_set . count ( prewhere_column ) ;
Names post_column_names ;
for ( const auto & name : column_names )
if ( ! pre_name_set . count ( name ) )
post_column_names . push_back ( name ) ;
column_names = post_column_names ;
}
/// will be used to distinguish between PREWHERE and WHERE columns when applying filter
column_name_set = NameSet { column_names . begin ( ) , column_names . end ( ) } ;
if ( check_columns )
{
/// Под owned_data_part->columns_lock проверим, что все запрошенные столбцы в куске того же типа, что в таблице.
/// Это может быть не так во время ALTER MODIFY.
if ( ! pre_column_names . empty ( ) )
storage . check ( owned_data_part - > columns , pre_column_names ) ;
if ( ! column_names . empty ( ) )
storage . check ( owned_data_part - > columns , column_names ) ;
pre_columns = storage . getColumnsList ( ) . addTypes ( pre_column_names ) ;
columns = storage . getColumnsList ( ) . addTypes ( column_names ) ;
}
else
{
pre_columns = owned_data_part - > columns . addTypes ( pre_column_names ) ;
columns = owned_data_part - > columns . addTypes ( column_names ) ;
}
/// Оценим общее количество строк - для прогресс-б а р а .
size_t total_rows = 0 ;
for ( const auto & range : all_mark_ranges )
total_rows + = range . end - range . begin ;
total_rows * = storage . index_granularity ;
LOG_TRACE ( log , " Reading " < < all_mark_ranges . size ( ) < < " ranges from part " < < owned_data_part - > name
< < " , approx. " < < total_rows
< < ( all_mark_ranges . size ( ) > 1
? " , up to " + toString ( ( all_mark_ranges . back ( ) . end - all_mark_ranges . front ( ) . begin ) * storage . index_granularity )
: " " )
< < " rows starting from " < < all_mark_ranges . front ( ) . begin * storage . index_granularity ) ;
setTotalRowsApprox ( total_rows ) ;
2013-12-02 12:15:39 +00:00
}
2016-03-30 19:59:43 +00:00
catch ( const Exception & e )
2014-07-17 13:41:47 +00:00
{
2016-03-30 19:59:43 +00:00
/// Подозрение на битый кусок. Кусок добавляется в очередь для проверки.
if ( e . code ( ) ! = ErrorCodes : : MEMORY_LIMIT_EXCEEDED )
storage . reportBrokenPart ( owned_data_part - > name ) ;
throw ;
2014-07-17 13:41:47 +00:00
}
2016-03-30 19:59:43 +00:00
catch ( . . . )
2014-07-17 13:41:47 +00:00
{
2016-03-30 19:59:43 +00:00
storage . reportBrokenPart ( owned_data_part - > name ) ;
throw ;
2014-07-17 13:41:47 +00:00
}
2013-04-24 10:31:32 +00:00
}
2014-06-26 00:58:14 +00:00
2015-06-08 20:22:02 +00:00
String getName ( ) const override { return " MergeTree " ; }
2013-05-03 10:20:53 +00:00
2015-01-21 03:56:28 +00:00
String getID ( ) const override
2013-05-03 10:20:53 +00:00
{
std : : stringstream res ;
2014-03-19 10:45:13 +00:00
res < < " MergeTree( " < < path < < " , columns " ;
2013-05-03 10:20:53 +00:00
2014-07-17 13:41:47 +00:00
for ( const NameAndTypePair & column : columns )
res < < " , " < < column . name ;
if ( prewhere_actions )
res < < " , prewhere, " < < prewhere_actions - > getID ( ) ;
2013-05-03 10:20:53 +00:00
res < < " , marks " ;
2013-11-26 11:55:11 +00:00
for ( size_t i = 0 ; i < all_mark_ranges . size ( ) ; + + i )
res < < " , " < < all_mark_ranges [ i ] . begin < < " , " < < all_mark_ranges [ i ] . end ;
2013-05-03 10:20:53 +00:00
res < < " ) " ;
return res . str ( ) ;
}
2014-06-26 00:58:14 +00:00
2013-04-24 10:31:32 +00:00
protected :
2014-02-10 09:15:38 +00:00
/// Будем вызывать progressImpl самостоятельно.
2014-10-25 18:33:52 +00:00
void progress ( const Progress & value ) override { }
2014-02-10 09:15:38 +00:00
2015-04-02 03:08:43 +00:00
/** Если некоторых запрошенных столбцов нет в куске,
* т о в ы я с н я е м , к а к и е с т о л б ц ы м о ж е т б ы т ь н е о б х о д и м о д о п о л н и т е л ь н о п р о ч и т а т ь ,
* ч т о б ы м о ж н о б ы л о в ы ч и с л и т ь DEFAULT в ы р а ж е н и е д л я э т и х с т о л б ц о в .
2015-04-02 03:17:10 +00:00
* Д о б а в л я е т и х в columns .
2015-04-02 03:08:43 +00:00
*/
2015-04-02 03:17:10 +00:00
NameSet injectRequiredColumns ( Names & columns ) const
2015-04-02 03:08:43 +00:00
{
2015-04-01 11:44:42 +00:00
NameSet required_columns { std : : begin ( columns ) , std : : end ( columns ) } ;
NameSet injected_columns ;
2014-10-24 10:48:47 +00:00
2015-09-14 20:02:39 +00:00
auto all_column_files_missing = true ;
2015-04-01 11:44:42 +00:00
for ( size_t i = 0 ; i < columns . size ( ) ; + + i )
2014-10-24 10:48:47 +00:00
{
2015-04-01 11:44:42 +00:00
const auto & column_name = columns [ i ] ;
2014-10-24 10:48:47 +00:00
2015-04-01 11:44:42 +00:00
/// column has files and hence does not require evaluation
if ( owned_data_part - > hasColumnFiles ( column_name ) )
2015-09-14 20:02:39 +00:00
{
all_column_files_missing = false ;
2015-04-01 11:44:42 +00:00
continue ;
2015-09-14 20:02:39 +00:00
}
2014-10-24 10:48:47 +00:00
2015-04-01 11:44:42 +00:00
const auto default_it = storage . column_defaults . find ( column_name ) ;
/// columns has no explicit default expression
if ( default_it = = std : : end ( storage . column_defaults ) )
continue ;
2015-03-31 12:57:14 +00:00
2015-04-01 11:44:42 +00:00
/// collect identifiers required for evaluation
IdentifierNameSet identifiers ;
default_it - > second . expression - > collectIdentifierNames ( identifiers ) ;
for ( const auto & identifier : identifiers )
2014-10-24 10:48:47 +00:00
{
2015-04-01 11:44:42 +00:00
if ( storage . hasColumn ( identifier ) )
2014-10-24 10:48:47 +00:00
{
2015-04-01 11:44:42 +00:00
/// ensure each column is added only once
if ( required_columns . count ( identifier ) = = 0 )
2014-10-24 10:48:47 +00:00
{
2015-04-01 11:44:42 +00:00
columns . emplace_back ( identifier ) ;
required_columns . emplace ( identifier ) ;
injected_columns . emplace ( identifier ) ;
2014-10-24 10:48:47 +00:00
}
}
}
}
2015-09-16 14:33:58 +00:00
/// If all files are missing read at least one column to determine correct column sizes
2015-09-14 20:02:39 +00:00
if ( all_column_files_missing )
{
2015-09-16 14:33:58 +00:00
const auto minimum_size_column_name = owned_data_part - > getMinimumSizeColumnName ( ) ;
columns . push_back ( minimum_size_column_name ) ;
injected_columns . insert ( minimum_size_column_name ) ;
2015-09-14 20:02:39 +00:00
}
2015-04-01 11:44:42 +00:00
return injected_columns ;
2014-10-24 10:48:47 +00:00
}
2015-04-02 03:08:43 +00:00
2015-01-21 03:56:28 +00:00
Block readImpl ( ) override
2013-04-24 10:31:32 +00:00
{
Block res ;
2013-11-26 11:55:11 +00:00
if ( remaining_mark_ranges . empty ( ) )
return res ;
if ( ! reader )
2013-04-24 10:31:32 +00:00
{
2015-04-16 06:12:35 +00:00
if ( use_uncompressed_cache )
owned_uncompressed_cache = storage . context . getUncompressedCache ( ) ;
owned_mark_cache = storage . context . getMarkCache ( ) ;
2016-07-21 16:22:24 +00:00
owned_null_mark_cache = storage . context . getNullMarkCache ( ) ;
2015-04-02 03:08:43 +00:00
2015-04-12 04:39:20 +00:00
reader . reset ( new MergeTreeReader (
2015-12-26 00:59:09 +00:00
path , owned_data_part , columns , owned_uncompressed_cache . get ( ) ,
2016-07-21 16:22:24 +00:00
owned_mark_cache . get ( ) , owned_null_mark_cache . get ( ) ,
save_marks_in_cache , storage ,
2015-04-12 04:39:20 +00:00
all_mark_ranges , min_bytes_to_use_direct_io , max_read_buffer_size ) ) ;
2015-04-02 03:08:43 +00:00
2013-12-02 12:15:39 +00:00
if ( prewhere_actions )
2015-04-12 04:39:20 +00:00
pre_reader . reset ( new MergeTreeReader (
2015-12-26 00:59:09 +00:00
path , owned_data_part , pre_columns , owned_uncompressed_cache . get ( ) ,
2016-07-21 16:22:24 +00:00
owned_mark_cache . get ( ) , owned_null_mark_cache . get ( ) ,
save_marks_in_cache , storage ,
2015-04-12 04:39:20 +00:00
all_mark_ranges , min_bytes_to_use_direct_io , max_read_buffer_size ) ) ;
2013-04-24 10:31:32 +00:00
}
2013-11-26 11:55:11 +00:00
2013-12-02 12:15:39 +00:00
if ( prewhere_actions )
2013-04-24 10:31:32 +00:00
{
2013-12-02 12:15:39 +00:00
do
{
/// Прочитаем полный блок столбцов, нужных для вычисления выражения в PREWHERE.
size_t space_left = std : : max ( 1LU , block_size / storage . index_granularity ) ;
MarkRanges ranges_to_read ;
2015-12-21 20:17:24 +00:00
while ( ! remaining_mark_ranges . empty ( ) & & space_left & & ! isCancelled ( ) )
2013-12-02 12:15:39 +00:00
{
MarkRange & range = remaining_mark_ranges . back ( ) ;
size_t marks_to_read = std : : min ( range . end - range . begin , space_left ) ;
pre_reader - > readRange ( range . begin , range . begin + marks_to_read , res ) ;
ranges_to_read . push_back ( MarkRange ( range . begin , range . begin + marks_to_read ) ) ;
space_left - = marks_to_read ;
range . begin + = marks_to_read ;
if ( range . begin = = range . end )
remaining_mark_ranges . pop_back ( ) ;
}
2015-12-21 20:17:24 +00:00
/// В случае isCancelled.
if ( ! res )
return res ;
2015-04-02 03:08:43 +00:00
progressImpl ( Progress ( res . rowsInFirstColumn ( ) , res . bytes ( ) ) ) ;
2015-09-14 20:02:39 +00:00
pre_reader - > fillMissingColumns ( res , ordered_names , should_reorder ) ;
2015-01-21 03:56:28 +00:00
2013-12-02 12:15:39 +00:00
/// Вычислим выражение в PREWHERE.
prewhere_actions - > execute ( res ) ;
ColumnPtr column = res . getByName ( prewhere_column ) . column ;
2013-12-05 13:07:55 +00:00
if ( remove_prewhere_column )
res . erase ( prewhere_column ) ;
2013-12-02 12:15:39 +00:00
2014-02-10 09:15:38 +00:00
size_t pre_bytes = res . bytes ( ) ;
2016-07-21 16:22:24 +00:00
ColumnPtr observed_column ;
if ( column . get ( ) - > isNullable ( ) )
{
ColumnNullable & nullable_col = static_cast < ColumnNullable & > ( * ( column . get ( ) ) ) ;
observed_column = nullable_col . getNestedColumn ( ) ;
}
else
observed_column = column ;
2013-12-02 12:15:39 +00:00
/** Если фильтр - константа (например, написано PREWHERE 1),
2015-04-02 03:08:43 +00:00
* т о л и б о в е р н ё м п у с т о й б л о к , л и б о в е р н ё м б л о к б е з и з м е н е н и й .
*/
2016-07-21 16:22:24 +00:00
if ( ColumnConstUInt8 * column_const = typeid_cast < ColumnConstUInt8 * > ( observed_column . get ( ) ) )
2013-12-02 12:15:39 +00:00
{
if ( ! column_const - > getData ( ) )
{
res . clear ( ) ;
return res ;
}
2014-04-22 22:52:00 +00:00
for ( size_t i = 0 ; i < ranges_to_read . size ( ) ; + + i )
{
2013-12-02 12:15:39 +00:00
const MarkRange & range = ranges_to_read [ i ] ;
reader - > readRange ( range . begin , range . end , res ) ;
}
2014-02-10 09:15:38 +00:00
2014-10-25 18:33:52 +00:00
progressImpl ( Progress ( 0 , res . bytes ( ) - pre_bytes ) ) ;
2013-12-02 12:15:39 +00:00
}
2016-07-21 16:22:24 +00:00
else if ( ColumnUInt8 * column_vec = typeid_cast < ColumnUInt8 * > ( observed_column . get ( ) ) )
2013-12-02 12:15:39 +00:00
{
size_t index_granularity = storage . index_granularity ;
2013-06-25 12:19:10 +00:00
2013-12-02 12:15:39 +00:00
const IColumn : : Filter & pre_filter = column_vec - > getData ( ) ;
IColumn : : Filter post_filter ( pre_filter . size ( ) ) ;
2013-11-11 05:35:58 +00:00
2013-12-02 12:15:39 +00:00
/// Прочитаем в нужных отрезках остальные столбцы и составим для них свой фильтр.
size_t pre_filter_pos = 0 ;
size_t post_filter_pos = 0 ;
2014-04-22 22:52:00 +00:00
for ( size_t i = 0 ; i < ranges_to_read . size ( ) ; + + i )
{
2013-12-02 12:15:39 +00:00
const MarkRange & range = ranges_to_read [ i ] ;
size_t begin = range . begin ;
size_t pre_filter_begin_pos = pre_filter_pos ;
for ( size_t mark = range . begin ; mark < = range . end ; + + mark )
{
UInt8 nonzero = 0 ;
if ( mark ! = range . end )
{
2013-12-05 12:41:47 +00:00
size_t limit = std : : min ( pre_filter . size ( ) , pre_filter_pos + index_granularity ) ;
for ( size_t row = pre_filter_pos ; row < limit ; + + row )
nonzero | = pre_filter [ row ] ;
2013-12-02 12:15:39 +00:00
}
if ( ! nonzero )
{
if ( mark > begin )
{
memcpy (
& post_filter [ post_filter_pos ] ,
& pre_filter [ pre_filter_begin_pos ] ,
pre_filter_pos - pre_filter_begin_pos ) ;
post_filter_pos + = pre_filter_pos - pre_filter_begin_pos ;
reader - > readRange ( begin , mark , res ) ;
}
begin = mark + 1 ;
pre_filter_begin_pos = std : : min ( pre_filter_pos + index_granularity , pre_filter . size ( ) ) ;
}
2014-02-10 10:49:56 +00:00
if ( mark < range . end )
pre_filter_pos = std : : min ( pre_filter_pos + index_granularity , pre_filter . size ( ) ) ;
2013-12-02 12:15:39 +00:00
}
}
if ( ! post_filter_pos )
{
res . clear ( ) ;
continue ;
}
2014-10-25 18:33:52 +00:00
progressImpl ( Progress ( 0 , res . bytes ( ) - pre_bytes ) ) ;
2014-02-10 09:15:38 +00:00
2013-12-02 12:15:39 +00:00
post_filter . resize ( post_filter_pos ) ;
/// Отфильтруем столбцы, относящиеся к PREWHERE, используя pre_filter,
/// остальные столбцы - используя post_filter.
size_t rows = 0 ;
for ( size_t i = 0 ; i < res . columns ( ) ; + + i )
{
2015-07-17 01:27:35 +00:00
ColumnWithTypeAndName & column = res . getByPosition ( i ) ;
2013-12-06 09:02:19 +00:00
if ( column . name = = prewhere_column & & res . columns ( ) > 1 )
2013-12-02 12:15:39 +00:00
continue ;
2015-12-05 07:01:18 +00:00
column . column = column . column - > filter ( column_name_set . count ( column . name ) ? post_filter : pre_filter , - 1 ) ;
2013-12-02 12:15:39 +00:00
rows = column . column - > size ( ) ;
}
/// Заменим столбец с о значением условия из PREWHERE на константу.
2013-12-05 13:07:55 +00:00
if ( ! remove_prewhere_column )
2016-05-28 05:31:36 +00:00
res . getByName ( prewhere_column ) . column = std : : make_shared < ColumnConstUInt8 > ( rows , 1 ) ;
2013-12-02 12:15:39 +00:00
}
else
throw Exception ( " Illegal type " + column - > getName ( ) + " of column for filter. Must be ColumnUInt8 or ColumnConstUInt8. " , ErrorCodes : : ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER ) ;
2015-12-21 20:17:24 +00:00
if ( res )
reader - > fillMissingColumnsAndReorder ( res , ordered_names ) ;
2013-12-02 12:15:39 +00:00
}
2013-12-05 12:41:47 +00:00
while ( ! remaining_mark_ranges . empty ( ) & & ! res & & ! isCancelled ( ) ) ;
2013-04-24 10:31:32 +00:00
}
2013-12-02 12:15:39 +00:00
else
{
size_t space_left = std : : max ( 1LU , block_size / storage . index_granularity ) ;
2015-09-25 13:20:00 +00:00
while ( ! remaining_mark_ranges . empty ( ) & & space_left & & ! isCancelled ( ) )
2013-12-02 12:15:39 +00:00
{
MarkRange & range = remaining_mark_ranges . back ( ) ;
size_t marks_to_read = std : : min ( range . end - range . begin , space_left ) ;
reader - > readRange ( range . begin , range . begin + marks_to_read , res ) ;
2013-11-11 05:35:58 +00:00
2013-12-02 12:15:39 +00:00
space_left - = marks_to_read ;
range . begin + = marks_to_read ;
if ( range . begin = = range . end )
remaining_mark_ranges . pop_back ( ) ;
}
2015-12-21 20:17:24 +00:00
/// В случае isCancelled.
if ( ! res )
return res ;
2014-02-10 09:15:38 +00:00
2015-12-21 20:17:24 +00:00
progressImpl ( Progress ( res . rowsInFirstColumn ( ) , res . bytes ( ) ) ) ;
2015-02-16 17:01:38 +00:00
reader - > fillMissingColumns ( res , ordered_names ) ;
2013-12-02 12:15:39 +00:00
}
2013-11-26 11:55:11 +00:00
if ( remaining_mark_ranges . empty ( ) )
2013-04-24 10:31:32 +00:00
{
/** Закрываем файлы (ещё до уничтожения объекта).
2014-07-23 09:15:41 +00:00
* Ч т о б ы п р и с о з д а н и и м н о г и х и с т о ч н и к о в , н о о д н о в р е м е н н о м ч т е н и и т о л ь к о и з н е с к о л ь к и х ,
* б у ф е р ы н е в и с е л и в п а м я т и .
*/
2014-04-22 22:58:05 +00:00
reader . reset ( ) ;
2014-07-14 14:07:47 +00:00
pre_reader . reset ( ) ;
part_columns_lock . reset ( ) ;
owned_data_part . reset ( ) ;
2013-04-24 10:31:32 +00:00
}
2013-11-26 11:55:11 +00:00
2013-04-24 10:31:32 +00:00
return res ;
}
2014-06-26 00:58:14 +00:00
2013-04-24 10:31:32 +00:00
private :
const String path ;
size_t block_size ;
2014-07-17 13:41:47 +00:00
NamesAndTypesList columns ;
2013-12-02 12:15:39 +00:00
NameSet column_name_set ;
2014-07-17 13:41:47 +00:00
NamesAndTypesList pre_columns ;
2014-03-09 17:36:01 +00:00
MergeTreeData & storage ;
2014-07-14 15:49:03 +00:00
MergeTreeData : : DataPartPtr owned_data_part ; /// Кусок не будет удалён, пока им владеет этот объект.
2014-07-14 14:07:47 +00:00
std : : unique_ptr < Poco : : ScopedReadRWLock > part_columns_lock ; /// Н е дадим изменить список столбцов куска, пока мы из него читаем.
2013-11-26 11:55:11 +00:00
MarkRanges all_mark_ranges ; /// В каких диапазонах засечек читать. В порядке возрастания номеров.
MarkRanges remaining_mark_ranges ; /// В каких диапазонах засечек еще не прочли.
/// В порядке убывания номеров, чтобы можно было выбрасывать из конца.
2013-09-08 05:53:10 +00:00
bool use_uncompressed_cache ;
2014-04-22 22:58:05 +00:00
std : : unique_ptr < MergeTreeReader > reader ;
std : : unique_ptr < MergeTreeReader > pre_reader ;
2013-11-28 13:16:46 +00:00
ExpressionActionsPtr prewhere_actions ;
String prewhere_column ;
2013-12-05 13:07:55 +00:00
bool remove_prewhere_column ;
2014-03-13 12:48:07 +00:00
Logger * log ;
2015-02-16 17:01:38 +00:00
2015-04-01 11:44:42 +00:00
/// column names in specific order as expected by other stages
Names ordered_names ;
2015-09-14 20:02:39 +00:00
bool should_reorder { false } ;
2015-04-12 04:39:20 +00:00
size_t min_bytes_to_use_direct_io ;
size_t max_read_buffer_size ;
2015-04-16 06:12:35 +00:00
UncompressedCachePtr owned_uncompressed_cache ;
MarkCachePtr owned_mark_cache ;
2016-07-21 16:22:24 +00:00
MarkCachePtr owned_null_mark_cache ;
2015-12-26 00:59:09 +00:00
/// Если выставлено в false - при отсутствии засечек в кэше, считавать засечки, но не сохранять их в кэш, чтобы не вымывать оттуда другие данные.
bool save_marks_in_cache ;
2013-04-24 10:31:32 +00:00
} ;
}