2017-07-15 04:06:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2017-07-24 12:58:01 +00:00
|
|
|
#include <unordered_map>
|
2018-05-16 10:25:10 +00:00
|
|
|
#include <Parsers/StringRange.h>
|
2017-07-15 04:06:51 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class IAST;
|
|
|
|
using ASTPtr = std::shared_ptr<IAST>;
|
|
|
|
|
2018-04-06 13:58:06 +00:00
|
|
|
class ExpressionActions;
|
|
|
|
using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>;
|
|
|
|
|
2017-07-15 04:06:51 +00:00
|
|
|
class Set;
|
|
|
|
using SetPtr = std::shared_ptr<Set>;
|
|
|
|
|
|
|
|
/// Information about calculated sets in right hand side of IN.
|
2018-05-21 10:47:27 +00:00
|
|
|
using PreparedSets = std::unordered_map<StringRange, SetPtr, StringRangePointersHash, StringRangePointersEqualTo>;
|
2017-07-15 04:06:51 +00:00
|
|
|
|
2018-04-11 14:31:54 +00:00
|
|
|
struct PrewhereInfo
|
|
|
|
{
|
|
|
|
/// Actions which are executed on block in order to get filter column for prewhere step.
|
|
|
|
ExpressionActionsPtr prewhere_actions;
|
|
|
|
String prewhere_column_name;
|
|
|
|
bool remove_prewhere_column = false;
|
|
|
|
|
|
|
|
PrewhereInfo() = default;
|
2018-04-12 09:45:24 +00:00
|
|
|
explicit PrewhereInfo(ExpressionActionsPtr prewhere_actions_, String prewhere_column_name_)
|
2018-04-11 14:31:54 +00:00
|
|
|
: prewhere_actions(std::move(prewhere_actions_)), prewhere_column_name(std::move(prewhere_column_name_)) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
using PrewhereInfoPtr = std::shared_ptr<PrewhereInfo>;
|
|
|
|
|
2017-07-15 04:06:51 +00:00
|
|
|
|
|
|
|
/** Query along with some additional data,
|
|
|
|
* that can be used during query processing
|
|
|
|
* inside storage engines.
|
|
|
|
*/
|
|
|
|
struct SelectQueryInfo
|
|
|
|
{
|
|
|
|
ASTPtr query;
|
|
|
|
|
2018-04-11 14:31:54 +00:00
|
|
|
PrewhereInfoPtr prewhere_info;
|
2018-04-06 13:58:06 +00:00
|
|
|
|
2017-07-15 04:06:51 +00:00
|
|
|
/// Prepared sets are used for indices by storage engine.
|
|
|
|
/// Example: x IN (1, 2, 3)
|
|
|
|
PreparedSets sets;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|