**Describe what's wrong**


**How to reproduce**


```sql

SELECT mapPopulateSeries(range(10), range(10), toUInt8(number))
FROM numbers(10)
LIMIT 1

Query id: 5eb2e3fb-26a0-4a17-8a37-9714d35095bd

┌─mapPopulateSeries(range(10), range(10), toUInt8(number))─┐
│ ([0],[0])                                                │
└──────────────────────────────────────────────────────────┘
┌─mapPopulateSeries(range(10), range(10), toUInt8(number))─┐
│ ([0],[0])                                                │
└──────────────────────────────────────────────────────────┘

2 rows in set. Elapsed: 0.004 sec.

SELECT mapPopulateSeries(range(900), range(900), materialize(1000)).2
FROM numbers(100)
FORMAT `Null`

Query id: 6418bf79-5d29-4709-86d6-7bdee9b7c9f7

← Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.)
1 rows in set. Elapsed: 0.014 sec.

Received exception from server (version 21.13.1):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Invalid number of rows in Chunk column Array(UInt16) position 0: expected 100, got 1. (LOGICAL_ERROR)

SELECT mapPopulateSeries(range(900), range(900), toUInt16(number)).2
FROM numbers(100)
LIMIT 1000

┌─tupleElement(mapPopulateSeries(range(900), range(900), toUInt16(number)), 2)─┐
│ [0]                                                                          │
└──────────────────────────────────────────────────────────────────────────────┘
→ Progress: 0.00 rows, 0.00 B (0.00 rows/s., 0.00 B/s.)
1 rows in set. Elapsed: 0.007 sec.

Received exception from server (version 21.13.1):
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Invalid number of rows in Chunk column Array(UInt16) position 0: expected 100, got 1. (LOGICAL_ERROR)

SELECT mapPopulateSeries(range(10), range(10), toUInt16(number))
FROM numbers(10)
LIMIT 1

Query id: 7b6d6e3d-19f1-489b-93a7-022eaa507af4


0 rows in set. Elapsed: 0.003 sec.

Received exception from server (version 21.13.1):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Max key type in mapPopulateSeries should be same as keys type: While processing mapPopulateSeries(range(10), range(10), toUInt16(number)). (ILLEGAL_TYPE_OF_ARGUMENT)
```

**Expected behavior**

> A clear and concise description of what you expected to happen.

**Error message and/or stacktrace**

```
Code: 49. DB::Exception: Received from localhost:9000. DB::Exception: Invalid number of rows in Chunk column Array(UInt16) position 0: expected 100, got 1. (LOGICAL_ERROR)
```
{
                res_map.insert({columns.in_keys_data[key_offset + i], columns.in_vals_data[val_offset + i]});
            }
            auto min_key = res_map.begin()->first;
            auto max_key = res_map.rbegin()->first;
            if (max_key_column)
            {
                
                if (max_key_is_const)
                {
                    max_key = max_key_const;
                }
                else
                {
                    max_key = (static_cast<const ColumnVector<KeyType> *>(max_key_column.get()))->getData()[row];
                }
                
                if (max_key < min_key)
                {
                    columns.out_keys_offsets.push_back(offset);
                    continue;
                }
            }
            static constexpr size_t MAX_ARRAY_SIZE = 1ULL << 30;
            if (static_cast<size_t>(max_key) - static_cast<size_t>(min_key) > MAX_ARRAY_SIZE)
                throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE, "Too large array size in the result of function {}", getName());
            
            KeyType key;
            for (key = min_key;; ++key)
            {