Invalid IPv4 value: while executing FUNCTION... when casting and User Defined Function #40508
Labels
comp-udf
Relates to User Defined Functions
potential bug
To be reviewed by developers and confirmed/rejected.
Describe what's wrong
SQL:
Result:
Received exception from server (version 22.7.3): Code: 441. DB::Exception: Received from localhost:9000. DB::Exception: Received from clickhouse-datanode-0.clickhouse-datanode.svc.cluster.local:9000. DB::Exception: Invalid IPv4 value: while executing 'FUNCTION IPv4StringToNum(arrayElement(CAST(tuple(string.keys, string.values), 'Map(String,String)'), 'clientIp') :: 7) -> IPv4StringToNum(arrayElement(CAST(tuple(string.keys, string.values), 'Map(String,String)'), 'clientIp')) UInt32 : 8'. (CANNOT_PARSE_DOMAIN_VALUE_FROM_STRING)
I have defined function
ip_to_provider
:CREATE FUNCTION if not exists ip_to_provider AS (x) -> dictGetString('geoip_asn_blocks_ipv4', 'autonomous_system_organization', tuple(IPv4StringToNum(x)));
When executing SQL without
having provider = 'Chinanet'
, it works:They are all valid IP, but if I add having, or use sub query with
where provider = 'Chinanet'
, it produced exception.Does it reproduce on recent release?
22.3.x ~ 22.7.x
How to reproduce
First you need have a dictionary
geoip_asn_blocks_ipv4
, refer to this project https://github.com/AlexeyKupershtokh/clickhouse-maxmind-geoip , create functionip_to_provider
, create a table with strings array, write some ip.Otherwise if you replace table, it can't reproduce this problem, like:
Error message and/or stacktrace
The text was updated successfully, but these errors were encountered: