Skip to content

Commit

Permalink
[fix](ip-search)fix ip search with inverted index (#44580)
Browse files Browse the repository at this point in the history
this pr is to solve is_ip_address_in_range with invalid param
  • Loading branch information
amorynan authored Nov 28, 2024
1 parent 913cda6 commit 016d389
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions be/src/vec/functions/function_ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,11 @@ class FunctionIsIPAddressInRange : public IFunction {
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>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -131,4 +136,4 @@ suite("test_ip_cidr_search_with_inverted_index", "nonConcurrent"){

execute_sql.call(create_sql.call())

}
}

0 comments on commit 016d389

Please sign in to comment.