From fec0c033ed7f779735beb4b58fdcd74161098de9 Mon Sep 17 00:00:00 2001 From: amorynan Date: Tue, 26 Nov 2024 09:42:32 +0800 Subject: [PATCH 1/2] fix ip search with inverted index --- be/src/vec/functions/function_ip.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/be/src/vec/functions/function_ip.h b/be/src/vec/functions/function_ip.h index b90d1b2bcf9434..724121ce57c109 100644 --- a/be/src/vec/functions/function_ip.h +++ b/be/src/vec/functions/function_ip.h @@ -694,6 +694,11 @@ class FunctionIsIPAddressInRange : public IFunction { reinterpret_cast(&cidr_range_ipv6_data[1]), cidr._prefix); min_ip = cidr_range_ipv6_data[0]; max_ip = cidr_range_ipv6_data[1]; + } else { + // if here param is invalid for current column to calcute min_ip|max_ip we just return + return Status::Error( + "Inverted index evaluate skipped, data type " + arg_type->get_name() + + " can not support this cidr " + arg_column->get_data_at(0).to_string()); } // apply for inverted index std::shared_ptr res_roaring = std::make_shared(); From 7171dcdc68ec615386a13004542b09490dbc8da3 Mon Sep 17 00:00:00 2001 From: amorynan Date: Tue, 26 Nov 2024 19:17:25 +0800 Subject: [PATCH 2/2] fix case --- .../test_ip_cidr_search_with_inverted_index.out | 4 ---- .../test_ip_cidr_search_with_inverted_index.groovy | 9 +++++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/regression-test/data/inverted_index_p0/test_ip_cidr_search_with_inverted_index.out b/regression-test/data/inverted_index_p0/test_ip_cidr_search_with_inverted_index.out index f365449b9e5244..2211a11b95a697 100644 --- a/regression-test/data/inverted_index_p0/test_ip_cidr_search_with_inverted_index.out +++ b/regression-test/data/inverted_index_p0/test_ip_cidr_search_with_inverted_index.out @@ -50,13 +50,9 @@ -- !sql -- --- !sql -- - -- !sql -- 2 42.117.228.166 2001:16a0:2:200a::2 --- !sql -- - -- !sql -- 5 255.255.255.255 \N diff --git a/regression-test/suites/inverted_index_p0/test_ip_cidr_search_with_inverted_index.groovy b/regression-test/suites/inverted_index_p0/test_ip_cidr_search_with_inverted_index.groovy index 61751f2404f2d2..191c818f351fde 100644 --- a/regression-test/suites/inverted_index_p0/test_ip_cidr_search_with_inverted_index.groovy +++ b/regression-test/suites/inverted_index_p0/test_ip_cidr_search_with_inverted_index.groovy @@ -118,8 +118,13 @@ suite("test_ip_cidr_search_with_inverted_index", "nonConcurrent"){ def execute_sql = { sqlList -> def i = 0 for (sqlStr in sqlList) { + if (i == 0 || i == 4 ) { + // inverted index will skip and do eval expr + ++i; + continue; + } try { - log.info("execute sql: i") + log.info("execute sql: ${i} : ${sqlStr}") GetDebugPoint().enableDebugPointForAllBEs(checkpoints_name, [req_id: i]) order_qt_sql """ ${sqlStr} """ } finally { @@ -131,4 +136,4 @@ suite("test_ip_cidr_search_with_inverted_index", "nonConcurrent"){ execute_sql.call(create_sql.call()) -} \ No newline at end of file +}