fix style

This commit is contained in:
CurtizJ 2018-10-19 16:04:50 +03:00
parent 8a72ddd94b
commit 6ff8a60460
6 changed files with 11 additions and 16 deletions

View File

@ -43,4 +43,3 @@ struct SortColumnDescription
using SortDescription = std::vector<SortColumnDescription>;
}

View File

@ -29,10 +29,10 @@ FinishSortingBlockInputStream::FinishSortingBlockInputStream(
size_t max_merged_block_size_, size_t limit_)
: description_sorted(description_sorted_), description_to_sort(description_to_sort_),
max_merged_block_size(max_merged_block_size_), limit(limit_)
{
if (!isPrefix(description_sorted, description_to_sort))
throw Exception("Can`t finish sorting. SortDescription of already sorted streamis not prefix of SortDescription needed to sort", ErrorCodes::LOGICAL_ERROR);
throw Exception("Can`t finish sorting. SortDescription of already sorted stream is not prefix of"
"SortDescription needed to sort", ErrorCodes::LOGICAL_ERROR);
children.push_back(input);
header = children.at(0)->getHeader();
@ -81,11 +81,9 @@ Block FinishSortingBlockInputStream::readImpl()
if (tail_block)
blocks.push_back(std::move(tail_block));
Block block;
size_t tail_pos = 0;
while (true)
{
block = children.back()->read();
Block block = children.back()->read();
/// End of input stream, but we can`t return immediatly, we need to merge already read blocks.
/// Check it later, when get end of stream from impl.
@ -104,7 +102,7 @@ Block FinishSortingBlockInputStream::readImpl()
if (size == 0)
continue;
/// We need to sort each block separatly before merging.
/// We need to sort each block separatly before merging.
sortBlock(block, description_to_sort);
removeConstantsFromBlock(block);
@ -128,7 +126,7 @@ Block FinishSortingBlockInputStream::readImpl()
/// and we should sort these rows in one chunk.
if (it != perm.end())
{
tail_pos = it - perm.begin();
size_t tail_pos = it - perm.begin();
Block head_block = block.cloneEmpty();
tail_block = block.cloneEmpty();
@ -161,4 +159,4 @@ Block FinishSortingBlockInputStream::readImpl()
return res;
}
}
}

View File

@ -48,4 +48,4 @@ private:
bool end_of_stream = false;
size_t total_rows_processed = 0;
};
}
}

View File

@ -45,6 +45,4 @@ void enrichBlockWithConstants(Block & block, const Block & header)
block.insert(i, {col_type_name.column->cloneResized(rows), col_type_name.type, col_type_name.name});
}
}
}
}

View File

@ -6,7 +6,7 @@
namespace DB
{
/** Functions for manipulate constansts for sorting.
/** Functions for manipulate constants for sorting.
* See MergeSortingBlocksBlockInputStream and FinishSortingBlockInputStream for details.
*/
@ -20,4 +20,4 @@ void removeConstantsFromSortDescription(const Block & header, SortDescription &
* constant columns from header (which must have structure as before removal of constants from block).
*/
void enrichBlockWithConstants(Block & block, const Block & header);
}
}

View File

@ -57,7 +57,6 @@ int main(int argc, char ** argv)
sort_descr_final.emplace_back("col1", 1, 1);
sort_descr_final.emplace_back("col2", 1, 1);
stream = std::make_shared<PartialSortingBlockInputStream>(stream, sort_descr_final);
stream = std::make_shared<FinishSortingBlockInputStream>(stream, sort_descr, sort_descr_final, n, 0);
{
@ -97,6 +96,7 @@ int main(int argc, char ** argv)
<< std::endl;
}
}
catch (const Exception & e)
{
std::cerr << e.displayText() << std::endl;
return -1;