22.12

```sql
SELECT
    toIPv6OrDefault('::ffff:10.10.10.10') AS ipv6,
    cutIPv6(ipv6, 10, 1)

┌─ipv6───────────────┬─cutIPv6(toIPv6OrDefault('::ffff:10.10.10.10'), 10, 1)─┐
│ ::ffff:10.10.10.10 │ ::ffff:10.10.10.0                                     │
└────────────────────┴───────────────────────────────────────────────────────┘
```

22.13.1.1476

```sql
SELECT
    toIPv6OrDefault('::ffff:10.10.10.10') AS ipv6,
    cutIPv6(ipv6, 10, 1)
Code: 43. DB::Exception: Illegal type IPv6 of argument 1 of function cutIPv6, expected FixedString(16): While processing toIPv6OrDefault('::ffff:10.10.10.10') AS ipv6, cutIPv6(ipv6, 10, 1). (ILLEGAL_TYPE_OF_ARGUMENT)
```

https://github.com/ClickHouse/ClickHouse/pull/45018
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
            UInt8 ipv6_zeroed_tail_bytes_count = ipv6_zeroed_tail_bytes->getValue<UInt8>();
            if (ipv6_zeroed_tail_bytes_count > IPV6_BINARY_LENGTH)
                throw Exception("Illegal value for argument 2 " + col_ipv6_zeroed_tail_bytes_type.type->getName() +
                                " of function " + getName(),
                                ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
            const auto * ipv4_zeroed_tail_bytes = checkAndGetColumnConst<ColumnVector<UInt8>>(col_ipv4_zeroed_tail_bytes.get());
            if (!ipv4_zeroed_tail_bytes)
                throw Exception("Illegal type " + col_ipv4_zeroed_tail_bytes_type.type->getName() +
                                " of argument 3 of function " + getName(),
                                ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
            UInt8 ipv4_zeroed_tail_bytes_count = ipv4_zeroed_tail_bytes->getValue<UInt8>();
            if (ipv4_zeroed_tail_bytes_count > IPV6_BINARY_LENGTH)
                throw Exception("Illegal value for argument 3 " + col_ipv4_zeroed_tail_bytes_type.type->getName() +
                                " of function " + getName(),
                                ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
            const auto size = col_in->size();
            const auto & vec_in = col_in->getChars();
            auto col_res = ColumnString::create();
            ColumnString::Chars & vec_res = col_res->getChars();
            ColumnString::Offsets & offsets_res = col_res->getOffsets();
            vec_res.resize(size * (IPV6_MAX_TEXT_LENGTH + 1));
            offsets_res.resize(size);
            auto * begin = reinterpret_cast<char *>(vec_res.data());
            auto * pos = begin;
            for (size_t offset = 0, i = 0; offset < vec_in.size(); offset += IPV6_BINARY_LENGTH, ++i)
            {
                const auto * address = &vec_in[offset];
                UInt8 zeroed_tail_bytes_count = isIPv4Mapped(address) ? ipv4_zeroed_tail_bytes_count : ipv6_zeroed_tail_bytes_count;
                cutAddress(reinterpret_cast<const unsigned char *>(address), pos, zeroed_tail_bytes_count);