**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)
```
{
        MutableColumnPtr res_column = res_type->createColumn();
        bool max_key_is_const = false;
        auto columns = res_column->getDataType() == TypeIndex::Tuple ? getInOutDataFromArrays<KeyType, ValType>(res_column, arg_columns)
                                                                     : getInOutDataFromMap<KeyType, ValType>(res_column, arg_columns);
        KeyType max_key_const{0};
        if (max_key_column && isColumnConst(*max_key_column))
        {
            const auto * column_const = static_cast<const ColumnConst *>(&*max_key_column);
            max_key_const = column_const->template getValue<KeyType>();