ClickHouse/src/Storages/ReadInOrderOptimizer.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.3 KiB
C++
Raw Normal View History

2019-12-10 23:18:24 +00:00
#pragma once
#include <Core/SortDescription.h>
#include <Storages/MergeTree/MergeTreeData.h>
#include <Storages/SelectQueryInfo.h>
namespace DB
{
/** Helper class, that can analyze MergeTree order key
* and required sort description to get their
* common prefix, which is needed for
2019-12-10 23:18:24 +00:00
* performing reading in order of PK.
*/
class ReadInOrderOptimizer
{
public:
ReadInOrderOptimizer(
const ASTSelectQuery & query,
2019-12-10 23:18:24 +00:00
const ManyExpressionActions & elements_actions,
const SortDescription & required_sort_description,
const TreeRewriterResultPtr & syntax_result);
2019-12-10 23:18:24 +00:00
InputOrderInfoPtr getInputOrder(const StorageMetadataPtr & metadata_snapshot, ContextPtr context, UInt64 limit = 0) const;
2019-12-10 23:18:24 +00:00
private:
InputOrderInfoPtr getInputOrderImpl(
const StorageMetadataPtr & metadata_snapshot,
const SortDescription & description,
const ManyExpressionActions & actions,
const ContextPtr & context,
UInt64 limit) const;
2020-02-14 07:12:04 +00:00
/// Actions for every element of order expression to analyze functions for monotonicity
2019-12-10 23:18:24 +00:00
ManyExpressionActions elements_actions;
NameSet forbidden_columns;
2021-05-21 17:01:21 +00:00
NameToNameMap array_join_result_to_source;
2019-12-11 01:34:39 +00:00
SortDescription required_sort_description;
const ASTSelectQuery & query;
2019-12-10 23:18:24 +00:00
};
2020-02-14 13:31:01 +00:00
}