mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
fix IN with nested tuples [#CLICKHOUSE-1999]
This commit is contained in:
parent
e7ee6dfd92
commit
be7c70da5c
@ -100,12 +100,18 @@ bool Set::insertFromBlock(const Block & block, bool create_ordered_set)
|
||||
materialized_columns.emplace_back(converted);
|
||||
key_columns.back() = materialized_columns.back().get();
|
||||
}
|
||||
}
|
||||
|
||||
/** Flatten tuples. For case when written
|
||||
* (a, b) IN (SELECT (a, b) FROM table)
|
||||
* instead of more typical
|
||||
* (a, b) IN (SELECT a, b FROM table)
|
||||
*/
|
||||
/** Flatten tuples. For case when written
|
||||
* (a, b) IN (SELECT (a, b) FROM table)
|
||||
* instead of more typical
|
||||
* (a, b) IN (SELECT a, b FROM table)
|
||||
*
|
||||
* Avoid flatten in case then we have more than one column:
|
||||
* Ex.: 1, (2, 3) become just 1, 2, 3
|
||||
*/
|
||||
if (keys_size == 1)
|
||||
{
|
||||
if (const ColumnTuple * tuple = typeid_cast<const ColumnTuple *>(key_columns.back()))
|
||||
{
|
||||
key_columns.pop_back();
|
||||
@ -229,7 +235,7 @@ void Set::createFromAST(const DataTypes & types, ASTPtr node, const Context & co
|
||||
if (value.isNull())
|
||||
break;
|
||||
|
||||
tuple_values[j] = value; /// TODO Сделать move семантику для Field.
|
||||
tuple_values[j] = value;
|
||||
}
|
||||
|
||||
if (j == tuple_size)
|
||||
|
@ -25,3 +25,8 @@
|
||||
1
|
||||
0
|
||||
1
|
||||
1 (2,3)
|
||||
2 (2,3)
|
||||
3 (2,3)
|
||||
4 (2,3)
|
||||
5 (2,3)
|
||||
|
@ -19,3 +19,8 @@ SELECT ['Hello', 'world'] IN ('world');
|
||||
SELECT ['Hello', 'world'] NOT IN ('world');
|
||||
SELECT ['Hello', 'world'] NOT IN ('Hello', 'world');
|
||||
SELECT ['Hello', 'world'] NOT IN ('hello', 'world');
|
||||
SELECT number, tuple FROM (SELECT 1 AS number, (2, 3) AS tuple) WHERE (number, tuple) IN (((1, (2, 3)), (4, (5, 6))));
|
||||
SELECT number, tuple FROM (SELECT 2 AS number, (2, 3) AS tuple) WHERE (number, tuple) IN ((2, (2, 3)));
|
||||
SELECT number, tuple FROM (SELECT 3 AS number, (2, 3) AS tuple) WHERE (number, tuple) IN (3, (2, 3));
|
||||
SELECT number, tuple FROM (SELECT 4 AS number, (2, 3) AS tuple) WHERE (number, tuple) IN (SELECT (4, (2, 3)));
|
||||
SELECT number, tuple FROM (SELECT 5 AS number, (2, 3) AS tuple) WHERE (number, tuple) IN (SELECT 5, (2, 3));
|
||||
|
Loading…
Reference in New Issue
Block a user