fix tryGetPreparedSet crash when same set expression built from different columns

This commit is contained in:
Duc Canh Le 2022-08-31 21:43:08 +08:00
parent ddac1b3f11
commit 55c20ce45b
3 changed files with 9 additions and 0 deletions

View File

@ -297,8 +297,13 @@ public:
assert(indexes_mapping.size() == data_types.size());
for (size_t i = 0; i < indexes_mapping.size(); ++i)
{
/// Same set expression can be construct from different column(s) with different types
if (indexes_mapping[i].tuple_index >= candidate_set->getDataTypes().size())
return false;
if (!candidate_set->areTypesEqual(indexes_mapping[i].tuple_index, data_types[i]))
return false;
}
return true;
};

View File

@ -0,0 +1,3 @@
CREATE TABLE set_crash (key1 Int32, id1 Int64, c1 Int64) ENGINE = MergeTree PARTITION BY id1 ORDER BY key1;
INSERT INTO set_crash VALUES (-1, 1, 0);
SELECT 1 in (-1,1) FROM set_crash WHERE (key1, id1) in (-1, 1);