mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
granularity
This commit is contained in:
parent
e3879c0933
commit
fa1e46f8a7
@ -3,6 +3,7 @@
|
||||
#include <Core/Field.h>
|
||||
#include <Core/Types.h>
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <Parsers/ASTExpressionList.h>
|
||||
#include <Parsers/ASTFunction.h>
|
||||
#include <Parsers/IAST.h>
|
||||
@ -21,7 +22,7 @@ public:
|
||||
String name;
|
||||
IAST * expr;
|
||||
ASTFunction * type;
|
||||
Field granularity;
|
||||
UInt64 granularity;
|
||||
|
||||
/** Get the text that identifies this element. */
|
||||
String getID(char) const override { return "Index"; }
|
||||
@ -52,7 +53,7 @@ public:
|
||||
s.ostr << (s.hilite ? hilite_keyword : "") << " TYPE " << (s.hilite ? hilite_none : "");
|
||||
type->formatImpl(s, state, frame);
|
||||
s.ostr << (s.hilite ? hilite_keyword : "") << " GRANULARITY " << (s.hilite ? hilite_none : "");
|
||||
s.ostr << applyVisitor(FieldVisitorToString(), granularity);
|
||||
s.ostr << toString(granularity);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -127,7 +127,7 @@ bool ParserIndexDeclaration::parseImpl(Pos & pos, ASTPtr & node, Expected & expe
|
||||
|
||||
auto index = std::make_shared<ASTIndexDeclaration>();
|
||||
index->name = typeid_cast<const ASTIdentifier &>(*name).name;
|
||||
index->granularity = typeid_cast<const ASTLiteral &>(*granularity).value;
|
||||
index->granularity = typeid_cast<const ASTLiteral &>(*granularity).value.get<UInt64>();
|
||||
index->set(index->expr, expr);
|
||||
index->set(index->type, type);
|
||||
node = index;
|
||||
|
@ -149,7 +149,7 @@ std::unique_ptr<IMergeTreeIndex> MergeTreeMinMaxIndexCreator(
|
||||
}
|
||||
|
||||
return std::make_unique<MergeTreeMinMaxIndex>(
|
||||
node->name, std::move(minmax_expr), columns, data_types, sample, node->granularity.get<size_t>());
|
||||
node->name, std::move(minmax_expr), columns, data_types, sample, node->granularity);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ std::unique_ptr<IMergeTreeIndex> MergeTreeUniqueIndexCreator(
|
||||
}
|
||||
|
||||
return std::make_unique<MergeTreeUniqueIndex>(
|
||||
node->name, std::move(unique_expr), columns, data_types, header, node->granularity.get<size_t>(), max_rows);
|
||||
node->name, std::move(unique_expr), columns, data_types, header, node->granularity, max_rows);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user