mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
fix index analysis with tuples and IN
This commit is contained in:
parent
24aaac59ca
commit
095e400075
@ -430,8 +430,9 @@ MergeTreeSetIndex::MergeTreeSetIndex(const Columns & set_elements, std::vector<K
|
||||
SortDescription sort_description;
|
||||
for (size_t i = 0; i < tuple_size; ++i)
|
||||
{
|
||||
block_to_sort.insert({ordered_set[i], nullptr, ordered_set[i]->getName()});
|
||||
sort_description.emplace_back(ordered_set[i]->getName(), 1, 1);
|
||||
String column_name = "_" + toString(i);
|
||||
block_to_sort.insert({ordered_set[i], nullptr, column_name});
|
||||
sort_description.emplace_back(column_name, 1, 1);
|
||||
}
|
||||
|
||||
sortBlock(block_to_sort, sort_description);
|
||||
|
2
tests/queries/0_stateless/02374_in_tuple_index.reference
Normal file
2
tests/queries/0_stateless/02374_in_tuple_index.reference
Normal file
@ -0,0 +1,2 @@
|
||||
2
|
||||
2
|
23
tests/queries/0_stateless/02374_in_tuple_index.sql
Normal file
23
tests/queries/0_stateless/02374_in_tuple_index.sql
Normal file
@ -0,0 +1,23 @@
|
||||
DROP TABLE IF EXISTS t_in_tuple_index;
|
||||
|
||||
CREATE TABLE t_in_tuple_index
|
||||
(
|
||||
`ID` String,
|
||||
`USER_ID` String,
|
||||
`PLATFORM` LowCardinality(String)
|
||||
)
|
||||
ENGINE = MergeTree()
|
||||
ORDER BY (PLATFORM, USER_ID, ID)
|
||||
SETTINGS index_granularity = 2048;
|
||||
|
||||
INSERT INTO t_in_tuple_index VALUES ('1', 33, 'insta'), ('2', 33, 'insta');
|
||||
|
||||
SELECT count()
|
||||
FROM t_in_tuple_index
|
||||
WHERE (PLATFORM, USER_ID) IN (('insta', '33'));
|
||||
|
||||
SELECT count()
|
||||
FROM t_in_tuple_index
|
||||
WHERE (PLATFORM, USER_ID) IN (('insta', '33'), ('insta', '22'));
|
||||
|
||||
DROP TABLE IF EXISTS t_in_tuple_index;
|
Loading…
Reference in New Issue
Block a user