mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Merge pull request #69736 from evillique/fix-ttl
Fix METADATA_MISMATCH due to TTL with WHERE
This commit is contained in:
commit
3efe136635
@ -248,7 +248,9 @@ TTLDescription TTLDescription::getTTLFromAST(
|
||||
if (ASTPtr where_expr_ast = ttl_element->where())
|
||||
{
|
||||
result.where_expression_ast = where_expr_ast->clone();
|
||||
where_expression = buildExpressionAndSets(where_expr_ast, columns.getAllPhysical(), context).expression;
|
||||
|
||||
ASTPtr ast = where_expr_ast->clone();
|
||||
where_expression = buildExpressionAndSets(ast, columns.getAllPhysical(), context).expression;
|
||||
result.where_expression_columns = where_expression->getRequiredColumnsWithTypes();
|
||||
result.where_result_column = where_expression->getSampleBlock().safeGetByPosition(0).name;
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
CREATE TABLE default.ttl\n(\n `a` UInt32,\n `timestamp` DateTime\n)\nENGINE = MergeTree\nORDER BY a\nTTL timestamp + toIntervalSecond(2) WHERE a IN (\n SELECT number\n FROM system.numbers\n LIMIT 100000\n)\nSETTINGS index_granularity = 8192
|
17
tests/queries/0_stateless/03236_create_query_ttl_where.sql
Normal file
17
tests/queries/0_stateless/03236_create_query_ttl_where.sql
Normal file
@ -0,0 +1,17 @@
|
||||
DROP TABLE IF EXISTS ttl;
|
||||
|
||||
CREATE TABLE ttl
|
||||
(
|
||||
`a` UInt32,
|
||||
`timestamp` DateTime
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY a
|
||||
TTL timestamp + toIntervalSecond(2) WHERE a IN (
|
||||
SELECT number
|
||||
FROM system.numbers
|
||||
LIMIT 100000
|
||||
);
|
||||
|
||||
SHOW CREATE ttl;
|
||||
DROP TABLE ttl;
|
Loading…
Reference in New Issue
Block a user