Remove SortDescription from IBlockInputStream.

This commit is contained in:
Nikolai Kochetov 2020-07-21 11:05:52 +03:00
parent 586872674b
commit cab9146ff3
6 changed files with 5 additions and 18 deletions

View File

@ -9,8 +9,8 @@ namespace ErrorCodes
}
DistinctSortedBlockInputStream::DistinctSortedBlockInputStream(
const BlockInputStreamPtr & input, const SizeLimits & set_size_limits_, UInt64 limit_hint_, const Names & columns)
: description(input->getSortDescription())
const BlockInputStreamPtr & input, SortDescription sort_description, const SizeLimits & set_size_limits_, UInt64 limit_hint_, const Names & columns)
: description(std::move(sort_description))
, columns_names(columns)
, limit_hint(limit_hint_)
, set_size_limits(set_size_limits_)

View File

@ -22,7 +22,7 @@ class DistinctSortedBlockInputStream : public IBlockInputStream
{
public:
/// Empty columns_ means all columns.
DistinctSortedBlockInputStream(const BlockInputStreamPtr & input, const SizeLimits & set_size_limits_, UInt64 limit_hint_, const Names & columns);
DistinctSortedBlockInputStream(const BlockInputStreamPtr & input, SortDescription sort_description, const SizeLimits & set_size_limits_, UInt64 limit_hint_, const Names & columns);
String getName() const override { return "DistinctSorted"; }
@ -48,7 +48,7 @@ private:
size_t rows,
ClearableSetVariants & variants) const;
const SortDescription & description;
SortDescription description;
struct PreviousBlock
{

View File

@ -26,10 +26,6 @@ namespace ErrorCodes
extern const int TOO_DEEP_PIPELINE;
}
const SortDescription & IBlockInputStream::getSortDescription() const
{
throw Exception("Output of " + getName() + " is not sorted", ErrorCodes::OUTPUT_IS_NOT_SORTED);
}
/// It's safe to access children without mutex as long as these methods are called before first call to `read()` or `readPrefix()`.

View File

@ -66,12 +66,6 @@ public:
return none;
}
/// If this stream generates data in order by some keys, return true.
virtual bool isSortedOutput() const { return false; }
/// In case of isSortedOutput, return corresponding SortDescription
virtual const SortDescription & getSortDescription() const;
/** Read next block.
* If there are no more blocks, return an empty block (for which operator `bool` returns false).
* NOTE: Only one thread can read from one instance of IBlockInputStream simultaneously.

View File

@ -30,9 +30,6 @@ public:
String getName() const override { return "MergingSorted"; }
bool isSortedOutput() const override { return true; }
const SortDescription & getSortDescription() const override { return description; }
Block getHeader() const override { return header; }
protected:

View File

@ -802,7 +802,7 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mergePartsToTempor
BlockInputStreamPtr merged_stream = std::make_shared<TreeExecutorBlockInputStream>(std::move(merged_pipe));
if (deduplicate)
merged_stream = std::make_shared<DistinctSortedBlockInputStream>(merged_stream, SizeLimits(), 0 /*limit_hint*/, Names());
merged_stream = std::make_shared<DistinctSortedBlockInputStream>(merged_stream, sort_description, SizeLimits(), 0 /*limit_hint*/, Names());
if (need_remove_expired_values)
merged_stream = std::make_shared<TTLBlockInputStream>(merged_stream, data, metadata_snapshot, new_data_part, time_of_merge, force_ttl);