mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fixed too deep AST traversal. [#CLICKHOUSE-2]
This commit is contained in:
parent
d2f1ef686e
commit
a4177287b1
@ -1560,7 +1560,11 @@ void ExpressionAnalyzer::tryMakeSetFromSubquery(const ASTPtr & subquery_or_table
|
||||
void ExpressionAnalyzer::makeSetsForIndexImpl(const ASTPtr & node, const Block & sample_block)
|
||||
{
|
||||
for (auto & child : node->children)
|
||||
makeSetsForIndexImpl(child, sample_block);
|
||||
{
|
||||
/// Process expression only in current subquery
|
||||
if (!typeid_cast<ASTSubquery *>(child.get()))
|
||||
makeSetsForIndexImpl(child, sample_block);
|
||||
}
|
||||
|
||||
const ASTFunction * func = typeid_cast<const ASTFunction *>(node.get());
|
||||
if (func && func->kind == ASTFunction::FUNCTION && functionIsInOperator(func->name))
|
||||
@ -1585,9 +1589,12 @@ void ExpressionAnalyzer::makeSetsForIndexImpl(const ASTPtr & node, const Block &
|
||||
}
|
||||
catch (const Exception & e)
|
||||
{
|
||||
/// in `sample_block` there are no columns that add `getActions`
|
||||
if (e.code() != ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK)
|
||||
/// in `sample_block` there are no columns that are added by `getActions`
|
||||
if (e.code() != ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK && e.code() != ErrorCodes::UNKNOWN_IDENTIFIER)
|
||||
throw;
|
||||
|
||||
/// TODO: Delete the catch in the next release
|
||||
tryLogCurrentException(&Poco::Logger::get("ExpressionAnalyzer"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
2018-01-29 100 key
|
||||
2018-01-29 100 key
|
||||
2
|
||||
|
@ -7,3 +7,19 @@ SELECT * FROM test.test WHERE toInt32(site_id) IN (100);
|
||||
SELECT * FROM test.test WHERE toInt32(site_id) IN (100,101);
|
||||
|
||||
DROP TABLE IF EXISTS test.test;
|
||||
|
||||
DROP TABLE IF EXISTS test.join_with_index;
|
||||
CREATE TABLE test.join_with_index (key UInt32, data UInt64) ENGINE = MergeTree ORDER BY key SETTINGS index_granularity=1;
|
||||
INSERT INTO test.join_with_index VALUES (1, 0), (2, 99);
|
||||
|
||||
SELECT key + 1
|
||||
FROM test.join_with_index
|
||||
ALL INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
key,
|
||||
data
|
||||
FROM test.join_with_index
|
||||
WHERE toUInt64(data) IN (0, 529335254087962442)
|
||||
) USING (key);
|
||||
DROP TABLE IF EXISTS test.join_with_index;
|
Loading…
Reference in New Issue
Block a user