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
{
        using ColumnType = ColumnVector<ArgType>;
        const ColumnPtr & column = arguments[0].column;
        if (const ColumnType * col = typeid_cast<const ColumnType *>(column.get()))
        {
            const typename ColumnType::Container & vec_in = col->getData();
            auto col_res = ColumnString::create();
            ColumnString::Chars & vec_res = col_res->getChars();
            ColumnString::Offsets & offsets_res = col_res->getOffsets();
            vec_res.resize(vec_in.size() * (IPV4_MAX_TEXT_LENGTH + 1)); 
            offsets_res.resize(vec_in.size());
            char * begin = reinterpret_cast<char *>(vec_res.data());
            char * pos = begin;
            for (size_t i = 0; i < vec_in.size(); ++i)
            {
                DB::formatIPv4(reinterpret_cast<const unsigned char*>(&vec_in[i]), sizeof(ArgType), pos, mask_tail_octets, "xxx");
                offsets_res[i] = pos - begin;
            }
            vec_res.resize(pos - begin);
            return col_res;
        }
        else
            throw Exception("Illegal column " + arguments[0].column->getName()
                            + " of argument of function " + getName(),
                            ErrorCodes::ILLEGAL_COLUMN);
    }
public:
    static constexpr auto name = Name::name;
    static FunctionPtr create(ContextPtr) { return std::make_shared<FunctionIPv4NumToString<mask_tail_octets, Name>>(); }