cleanup and update comments

This commit is contained in:
CurtizJ 2019-08-26 18:25:18 +03:00
parent c63eeb8933
commit 4a7459f3b3
7 changed files with 15 additions and 45 deletions

View File

@ -86,10 +86,6 @@
#include <DataTypes/DataTypeAggregateFunction.h>
#include <DataStreams/materializeBlock.h>
#include <IO/WriteBufferFromOStream.h>
#include <Processors/printPipeline.h>
namespace DB
{
@ -2136,7 +2132,7 @@ void InterpreterSelectQuery::executeOrder(QueryPipeline & pipeline, SortingInfoP
pipeline.addSimpleTransform([&](const Block & header) -> ProcessorPtr
{
return std::make_shared<FinishSortingTransform>(
header, sorting_info->prefix_order_descr,
header, sorting_info->prefix_order_descr,
order_descr, settings.max_block_size, limit);
});
}

View File

@ -63,7 +63,7 @@ void FinishSortingTransform::consume(Chunk chunk)
generated_prefix = false;
// If there were only const columns in sort description, then there is no need to sort.
// Return the blocks as is.
// Return the chunks as is.
if (description.empty())
{
generated_chunk = std::move(chunk);
@ -72,7 +72,7 @@ void FinishSortingTransform::consume(Chunk chunk)
removeConstColumns(chunk);
/// Find the position of last already read key in current block.
/// Find the position of last already read key in current chunk.
if (!chunks.empty())
{
size_t size = chunk.getNumRows();
@ -91,8 +91,8 @@ void FinishSortingTransform::consume(Chunk chunk)
size_t tail_pos = high;
/// We need to save tail of block, because next block may starts with the same key as in tail
/// and we should sort these rows in one chunk.
/// We need to save tail of chunk, because next chunk may starts with the same key as in tail
/// and we should sort these rows in one portion.
if (tail_pos != size)
{
auto source_columns = chunk.detachColumns();
@ -112,8 +112,8 @@ void FinishSortingTransform::consume(Chunk chunk)
}
}
/// If we reach here, that means that current block is first in chunk
/// or it all consists of rows with the same key as tail of a previous block.
/// If we reach here, that means that current cunk is first in portion
/// or it all consists of rows with the same key as tail of a previous chunk.
chunks.push_back(std::move(chunk));
}

View File

@ -1,8 +1,5 @@
#pragma once
#include <Core/SortDescription.h>
#include <Processors/IProcessor.h>
#include <Processors/Transforms/MergeSortingTransform.h>
#include <Processors/Transforms/SortingTransform.h>
namespace DB
{
@ -28,7 +25,6 @@ private:
SortDescription description_sorted;
Chunk tail_chunk;
// Chunks chunks;
bool end_of_stream = false;
size_t total_rows_processed = 0;

View File

@ -1,7 +1,6 @@
#include <Processors/Transforms/MergeSortingTransform.h>
#include <Core/SortDescription.h>
#include <Core/SortCursor.h>
#include <Processors/IAccumulatingTransform.h>
#include <Processors/Transforms/MergingSortedTransform.h>
#include <Common/formatReadable.h>
#include <Common/ProfileEvents.h>
@ -12,9 +11,6 @@
#include <DataStreams/NativeBlockInputStream.h>
#include <DataStreams/NativeBlockOutputStream.h>
#include <queue>
#include <Processors/Transforms/MergingSortedTransform.h>
namespace ProfileEvents
{

View File

@ -40,8 +40,7 @@ private:
size_t max_bytes_before_external_sort;
const std::string tmp_path;
Logger * log = &Logger::get("MergeSortingBlockInputStream");
// Chunks chunks;
Logger * log = &Logger::get("MergeSortingTransform");
/// If remerge doesn't save memory at least several times, mark it as useless and don't do it anymore.
bool remerge_is_useful = true;

View File

@ -12,10 +12,6 @@
#include <DataStreams/NativeBlockInputStream.h>
#include <DataStreams/NativeBlockOutputStream.h>
#include <queue>
#include <Processors/ISource.h>
#include <Processors/Transforms/MergingSortedTransform.h>
namespace ProfileEvents
{

View File

@ -1,26 +1,12 @@
#pragma once
#include <Processors/IAccumulatingTransform.h>
#include <Processors/IProcessor.h>
#include <Core/SortDescription.h>
#include <Core/SortCursor.h>
#include <Poco/TemporaryFile.h>
#include <DataStreams/IBlockInputStream.h>
#include <DataStreams/NativeBlockInputStream.h>
#include <DataStreams/NativeBlockOutputStream.h>
#include <Processors/ISource.h>
#include <common/logger_useful.h>
#include <queue>
namespace ProfileEvents
{
extern const Event ExternalSortWritePart;
extern const Event ExternalSortMerge;
}
namespace DB
{
@ -72,7 +58,9 @@ private:
MergeSorter merge_sorter;
};
/** Base class for sorting.
* Currently there are two implementations: MergeSortingTransform and FinishSortingTransform.
*/
class SortingTransform : public IProcessor
{
public:
@ -91,7 +79,6 @@ protected:
virtual void generate() = 0;
virtual void serialize();
protected:
SortDescription description;
size_t max_merged_block_size;
UInt64 limit;