```sql
CREATE TABLE test_tbl
(   `ip` String, `ipv6` IPv6 MATERIALIZED toIPv6(ip) )
ENGINE = Memory;

insert into test_tbl(ip) values ( 'fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''), ('::ffff:1.1.1.1' );

 DB::Exception: Invalid IPv6 value: while executing 'FUNCTION _CAST(toIPv6(ip) :: 2, 'IPv6' :: 1)


set cast_ipv4_ipv6_default_on_conversion_error=1;
insert into test_tbl(ip) values ( 'fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''), ('::ffff:1.1.1.1' );
 
 DB::Exception: Invalid IPv6 value: while executing 'FUNCTION _CAST(toIPv6(ip)
```

`toIPv6OrDefault` does not help in this case.

```sql
CREATE TABLE test_tbl
(   `ip` String, `ipv6` IPv6 MATERIALIZED toIPv6OrDefault(ip) )
ENGINE = Memory;

insert into test_tbl(ip) values ( 'fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''), ('::ffff:1.1.1.1' );
  DB::Exception: Invalid IPv6 value: while executing 'FUNCTION _CAST(toIPv6OrD

insert into test_tbl(ip) values ( 'fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''), ('::ffff:1.1.1.1' ), ('garbudge');
  DB::Exception: Invalid IPv6 value: while executing 'FUNCTION
```

WA:

```sql
CREATE TABLE test_tbl
(   `ip` String, `ipv6` IPv6 MATERIALIZED if(ip='', '::', ip) )
ENGINE = Memory;

insert into test_tbl(ip) values ( 'fe80::9801:43ff:fe1f:7690'), ('1.1.1.1'), (''), ('::ffff:1.1.1.1' );

select ip, ipv6 from test_tbl;
┌─ip────────────────────────┬─ipv6──────────────────────┐
│ fe80::9801:43ff:fe1f:7690 │ fe80::9801:43ff:fe1f:7690 │
│ 1.1.1.1                   │ ::ffff:1.1.1.1            │
│                           │ ::                        │
│ ::ffff:1.1.1.1            │ ::ffff:1.1.1.1            │
└───────────────────────────┴───────────────────────────┘
```
{
    FormatSettings format_settings;
    format_settings.avro.allow_missing_fields = settings.input_format_avro_allow_missing_fields;
    format_settings.avro.output_codec = settings.output_format_avro_codec;
    format_settings.avro.output_sync_interval = settings.output_format_avro_sync_interval;
    format_settings.avro.schema_registry_url = settings.format_avro_schema_registry_url.toString();
    format_settings.avro.string_column_pattern = settings.output_format_avro_string_column_pattern.toString();
    format_settings.avro.output_rows_in_file = settings.output_format_avro_rows_in_file;
    format_settings.csv.allow_double_quotes = settings.format_csv_allow_double_quotes;
    format_settings.csv.allow_single_quotes = settings.format_csv_allow_single_quotes;
    format_settings.csv.crlf_end_of_line = settings.output_format_csv_crlf_end_of_line;
    format_settings.csv.delimiter = settings.format_csv_delimiter;
    format_settings.csv.tuple_delimiter = settings.format_csv_delimiter;
    format_settings.csv.empty_as_default = settings.input_format_csv_empty_as_default;
    format_settings.csv.input_format_enum_as_number = settings.input_format_csv_enum_as_number;
    format_settings.csv.null_representation = settings.format_csv_null_representation;
    format_settings.csv.input_format_arrays_as_nested_csv = settings.input_format_csv_arrays_as_nested_csv;
    format_settings.hive_text.fields_delimiter = settings.input_format_hive_text_fields_delimiter;
    format_settings.hive_text.collection_items_delimiter = settings.input_format_hive_text_collection_items_delimiter;
    format_settings.hive_text.map_keys_delimiter = settings.input_format_hive_text_map_keys_delimiter;
    format_settings.custom.escaping_rule = settings.format_custom_escaping_rule;
    format_settings.custom.field_delimiter = settings.format_custom_field_delimiter;
    format_settings.custom.result_after_delimiter = settings.format_custom_result_after_delimiter;
    format_settings.custom.result_before_delimiter = settings.format_custom_result_before_delimiter;
    format_settings.custom.row_after_delimiter = settings.format_custom_row_after_delimiter;
    format_settings.custom.row_before_delimiter = settings.format_custom_row_before_delimiter;
    format_settings.custom.row_between_delimiter = settings.format_custom_row_between_delimiter;
    format_settings.date_time_input_format = settings.date_time_input_format;
    format_settings.date_time_output_format = settings.date_time_output_format;