ISSUES-2581 get pointer to max_blocls

This commit is contained in:
VadimPE 2018-09-24 12:53:28 +03:00
parent 8c413e3f1f
commit 28102bc3b5
5 changed files with 16 additions and 10 deletions

View File

@ -137,7 +137,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::read(
const Context & context,
const size_t max_block_size,
const unsigned num_streams,
const PartitionIdToMaxBlock & max_blocks_number_to_read) const
const PartitionIdToMaxBlock* max_blocks_number_to_read) const
{
return readFromParts(
data.getDataPartsVector(), column_names_to_return, query_info, context,
@ -151,7 +151,7 @@ BlockInputStreams MergeTreeDataSelectExecutor::readFromParts(
const Context & context,
const size_t max_block_size,
const unsigned num_streams,
const PartitionIdToMaxBlock & max_blocks_number_to_read) const
const PartitionIdToMaxBlock* max_blocks_number_to_read) const
{
size_t part_index = 0;
@ -271,9 +271,12 @@ BlockInputStreams MergeTreeDataSelectExecutor::readFromParts(
part->minmax_idx.parallelogram, data.minmax_idx_column_types))
continue;
auto blocks_iterator = max_blocks_number_to_read.find(part->info.partition_id);
if (blocks_iterator != max_blocks_number_to_read.end() && part->info.max_block > blocks_iterator->second)
continue;
if (max_blocks_number_to_read)
{
auto blocks_iterator = max_blocks_number_to_read->find(part->info.partition_id);
if (blocks_iterator != max_blocks_number_to_read->end() && part->info.max_block > blocks_iterator->second)
continue;
}
parts.push_back(part);
}

View File

@ -30,7 +30,7 @@ public:
const Context & context,
size_t max_block_size,
unsigned num_streams,
const PartitionIdToMaxBlock & max_blocks_number_to_read) const;
const PartitionIdToMaxBlock* max_blocks_number_to_read = nullptr) const;
BlockInputStreams readFromParts(
MergeTreeData::DataPartsVector parts,
@ -39,7 +39,7 @@ public:
const Context & context,
size_t max_block_size,
unsigned num_streams,
const PartitionIdToMaxBlock & max_blocks_number_to_read) const;
const PartitionIdToMaxBlock* max_blocks_number_to_read = nullptr) const;
private:
MergeTreeData & data;

View File

@ -27,7 +27,7 @@ public:
unsigned num_streams) override
{
return MergeTreeDataSelectExecutor(part->storage).readFromParts(
{part}, column_names, query_info, context, max_block_size, num_streams, {});
{part}, column_names, query_info, context, max_block_size, num_streams);
}
bool supportsIndexForIn() const override { return true; }

View File

@ -114,7 +114,7 @@ BlockInputStreams StorageMergeTree::read(
const size_t max_block_size,
const unsigned num_streams)
{
return reader.read(column_names, query_info, context, max_block_size, num_streams, {});
return reader.read(column_names, query_info, context, max_block_size, num_streams);
}
BlockOutputStreamPtr StorageMergeTree::write(const ASTPtr & /*query*/, const Settings & /*settings*/)

View File

@ -2995,7 +2995,10 @@ BlockInputStreams StorageReplicatedMergeTree::read(
}
}
return reader.read(column_names, query_info, context, max_block_size, num_streams, max_added_blocks);
if (max_added_blocks.empty())
return reader.read(column_names, query_info, context, max_block_size, num_streams);
else
return reader.read(column_names, query_info, context, max_block_size, num_streams, &max_added_blocks);
}