This is an automated email from the ASF dual-hosted git repository.

airborne pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new ad29b07ea5e [fix](ip-search)fix ip search with inverted index (#44580) 
(#44712)
ad29b07ea5e is described below

commit ad29b07ea5e86512170274bd94861c40c5364bdc
Author: amory <[email protected]>
AuthorDate: Fri Nov 29 15:16:13 2024 +0800

    [fix](ip-search)fix ip search with inverted index (#44580) (#44712)
    
    this pr is to solve is_ip_address_in_range with invalid param
    pick from #44712
---
 be/src/vec/functions/function_ip.h                               | 5 +++++
 .../test_ip_cidr_search_with_inverted_index.out                  | 4 ----
 .../test_ip_cidr_search_with_inverted_index.groovy               | 9 +++++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/be/src/vec/functions/function_ip.h 
b/be/src/vec/functions/function_ip.h
index 25f09bb594a..b60e1f393f8 100644
--- a/be/src/vec/functions/function_ip.h
+++ b/be/src/vec/functions/function_ip.h
@@ -694,6 +694,11 @@ public:
                             reinterpret_cast<char*>(&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<ErrorCode::INVERTED_INDEX_EVALUATE_SKIPPED>(
+                    "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<roaring::Roaring> res_roaring = 
std::make_shared<roaring::Roaring>();
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 f365449b9e5..2211a11b95a 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 61751f2404f..191c818f351 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
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to