mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 08:52:06 +00:00
fixed constructor
This commit is contained in:
parent
6490c23aa6
commit
3f8c2ad814
@ -58,8 +58,17 @@ using IndexConditionPtr = std::shared_ptr<IndexCondition>;
|
||||
class MergeTreeIndex
|
||||
{
|
||||
public:
|
||||
MergeTreeIndex(String name, ExpressionActionsPtr expr, size_t granularity)
|
||||
: name(name), expr(expr), granularity(granularity) {}
|
||||
MergeTreeIndex(
|
||||
String name,
|
||||
ExpressionActionsPtr expr,
|
||||
const Names & columns,
|
||||
const DataTypes & data_types,
|
||||
size_t granularity)
|
||||
: name(name)
|
||||
, expr(expr)
|
||||
, columns(columns)
|
||||
, data_types(data_types)
|
||||
, granularity(granularity) {}
|
||||
|
||||
virtual ~MergeTreeIndex() = default;
|
||||
|
||||
@ -73,9 +82,9 @@ public:
|
||||
|
||||
String name;
|
||||
ExpressionActionsPtr expr;
|
||||
size_t granularity;
|
||||
Names columns;
|
||||
DataTypes data_types;
|
||||
size_t granularity;
|
||||
};
|
||||
|
||||
|
||||
|
@ -162,24 +162,25 @@ std::unique_ptr<MergeTreeIndex> MergeTreeMinMaxIndexCreator(
|
||||
expr_list, data.getColumns().getAllPhysical());
|
||||
auto minmax_expr = ExpressionAnalyzer(expr_list, syntax, context).getActions(false);
|
||||
|
||||
auto minmax = std::make_unique<MergeTreeMinMaxIndex>(
|
||||
node->name, std::move(minmax_expr), node->granularity.get<size_t>());
|
||||
|
||||
auto sample = ExpressionAnalyzer(expr_list, syntax, context)
|
||||
.getActions(true)->getSampleBlock();
|
||||
|
||||
Names columns;
|
||||
DataTypes data_types;
|
||||
|
||||
Poco::Logger * log = &Poco::Logger::get("minmax_idx");
|
||||
LOG_DEBUG(log, "new minmax index");
|
||||
for (size_t i = 0; i < expr_list->children.size(); ++i)
|
||||
{
|
||||
const auto & column = sample.getByPosition(i);
|
||||
|
||||
minmax->columns.emplace_back(column.name);
|
||||
minmax->data_types.emplace_back(column.type);
|
||||
columns.emplace_back(column.name);
|
||||
data_types.emplace_back(column.type);
|
||||
LOG_DEBUG(log, ">" << column.name << " " << column.type->getName());
|
||||
}
|
||||
|
||||
return minmax;
|
||||
return std::make_unique<MergeTreeMinMaxIndex>(
|
||||
node->name, std::move(minmax_expr), columns, data_types, node->granularity.get<size_t>());;
|
||||
}
|
||||
|
||||
}
|
@ -63,8 +63,13 @@ private:
|
||||
class MergeTreeMinMaxIndex : public MergeTreeIndex
|
||||
{
|
||||
public:
|
||||
MergeTreeMinMaxIndex(String name, ExpressionActionsPtr expr, size_t granularity)
|
||||
: MergeTreeIndex(name, expr, granularity) {}
|
||||
MergeTreeMinMaxIndex(
|
||||
String name,
|
||||
ExpressionActionsPtr expr,
|
||||
const Names & columns,
|
||||
const DataTypes & data_types,
|
||||
size_t granularity)
|
||||
: MergeTreeIndex(name, expr, columns, data_types, granularity) {}
|
||||
|
||||
~MergeTreeMinMaxIndex() override = default;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user