amorynan commented on code in PR #28556: URL: https://github.com/apache/doris/pull/28556#discussion_r1442541249
########## be/src/vec/functions/function_ip.h: ########## @@ -348,4 +348,138 @@ class FunctionIPv6NumToString : public IFunction { } }; +class FunctionIsIPv4String : public IFunction { +private: + Status execute_type(Block& block, const ColumnWithTypeAndName& argument, size_t result) const { + const ColumnPtr& column = argument.column; + + if (const auto* nullable_src = typeid_cast<const ColumnNullable*>(column.get())) { + size_t col_size = nullable_src->size(); + auto col_res = ColumnUInt8::create(col_size, 0); + auto null_map = ColumnUInt8::create(col_size, 0); + + for (size_t i = 0; i < col_size; ++i) { + if (nullable_src->is_null_at(i)) { + null_map->get_data()[i] = 1; + } else { + StringRef ipv4_str = nullable_src->get_data_at(i); + if (IPv4Value::is_valid_string(ipv4_str.data, ipv4_str.size)) { Review Comment: why not deal with invalid string ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org