add tests

This commit is contained in:
Anton Popov 2023-03-28 17:17:42 +00:00
parent 6d05968a0f
commit 1e79245b94
4 changed files with 37 additions and 0 deletions

View File

@ -663,6 +663,12 @@ public:
auto result_keys = keys_data_left.cloneEmpty();
auto result_values = values_data_left.cloneEmpty();
size_t size_to_reserve = keys_data_right.size() + (keys_data_left.size() - keys_data_right.size());
result_keys->reserve(size_to_reserve);
result_values->reserve(size_to_reserve);
auto result_offsets = ColumnVector<IColumn::Offset>::create(input_rows_count);
auto & result_offsets_data = result_offsets->getData();

View File

@ -0,0 +1,22 @@
<test>
<query>
WITH (range(10), range(10))::Map(String, UInt64) AS m1, (range(3), range(3))::Map(String, UInt64) AS m2
SELECT count() FROM numbers(500000)
WHERE NOT ignore(mapUpdate(materialize(m1), materialize(m2)))
</query>
<query>
WITH (range(10), range(10))::Map(String, UInt64) AS m1, (range(3), range(3))::Map(String, UInt64) AS m2
SELECT count() FROM numbers(500000)
WHERE NOT ignore(mapUpdate(materialize(m1), m2))
</query>
<query>
WITH (range(100), range(100))::Map(String, UInt64) AS m1, (range(30), range(30))::Map(String, UInt64) AS m2
SELECT count() FROM numbers(50000)
WHERE NOT ignore(mapUpdate(materialize(m1), materialize(m2)))
</query>
<query>
WITH (range(100), range(100))::Map(String, UInt64) AS m1, (range(30), range(30))::Map(String, UInt64) AS m2
SELECT count() FROM numbers(50000)
WHERE NOT ignore(mapUpdate(materialize(m1), m2))
</query>
</test>

View File

@ -31,3 +31,7 @@
{1:2,2:3}
{'x':'y','x':'y'}
{'x':'y','x':'y'}
{'k1':11,'k2':22}
{'k1':11,'k2':22}
{'k1':11,'k2':22}
{'k1':11,'k2':22}

View File

@ -15,6 +15,11 @@ SELECT mapApply((x, y) -> (x, x + 1), materialize(map(1, 0, 2, 0)));
SELECT mapApply((x, y) -> ('x', 'y'), map(1, 0, 2, 0));
SELECT mapApply((x, y) -> ('x', 'y'), materialize(map(1, 0, 2, 0)));
SELECT mapUpdate(map('k1', 1, 'k2', 2), map('k1', 11, 'k2', 22));
SELECT mapUpdate(materialize(map('k1', 1, 'k2', 2)), map('k1', 11, 'k2', 22));
SELECT mapUpdate(map('k1', 1, 'k2', 2), materialize(map('k1', 11, 'k2', 22)));
SELECT mapUpdate(materialize(map('k1', 1, 'k2', 2)), materialize(map('k1', 11, 'k2', 22)));
SELECT mapApply(); -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
SELECT mapApply((x, y) -> (x), map(1, 0, 2, 0)); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT mapApply((x, y) -> ('x'), map(1, 0, 2, 0)); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }