mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Add default granularity
This commit is contained in:
parent
b80ee8df50
commit
dd7fef11a2
@ -131,15 +131,15 @@ bool ParserIndexDeclaration::parseImpl(Pos & pos, ASTPtr & node, Expected & expe
|
||||
if (!data_type_p.parse(pos, type, expected))
|
||||
return false;
|
||||
|
||||
if (!s_granularity.ignore(pos, expected))
|
||||
return false;
|
||||
|
||||
if (!granularity_p.parse(pos, granularity, expected))
|
||||
return false;
|
||||
if (s_granularity.ignore(pos, expected))
|
||||
{
|
||||
if (!granularity_p.parse(pos, granularity, expected))
|
||||
return false;
|
||||
}
|
||||
|
||||
auto index = std::make_shared<ASTIndexDeclaration>();
|
||||
index->name = name->as<ASTIdentifier &>().name();
|
||||
index->granularity = granularity->as<ASTLiteral &>().value.safeGet<UInt64>();
|
||||
index->granularity = granularity ? granularity->as<ASTLiteral &>().value.safeGet<UInt64>() : 1;
|
||||
index->set(index->expr, expr);
|
||||
index->set(index->type, type);
|
||||
node = index;
|
||||
|
@ -0,0 +1 @@
|
||||
CREATE TABLE default.users_02534\n(\n `id` Int16,\n `name` String,\n INDEX bf_idx name TYPE minmax GRANULARITY 1\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 8192
|
4
tests/queries/0_stateless/02534_default_granularity.sql
Normal file
4
tests/queries/0_stateless/02534_default_granularity.sql
Normal file
@ -0,0 +1,4 @@
|
||||
DROP TABLE IF EXISTS users_02534;
|
||||
CREATE TABLE users_02534 (id Int16, name String, INDEX bf_idx(name) TYPE minmax) ENGINE=MergeTree ORDER BY id;
|
||||
SHOW CREATE TABLE users_02534;
|
||||
DROP TABLE users_02534;
|
Loading…
Reference in New Issue
Block a user