Skip to content

Commit

Permalink
[Fix](inverted index) Resolve null processing issue in arrays_overlap (
Browse files Browse the repository at this point in the history
…apache#41495)

## Proposed changes

Fix problem "Runtime Error: Null pointer passed to
'StringTypeInvertedIndexReader::query', which requires a non-null
argument."
```

Stack Trace:
#0 doris::segment_v2::StringTypeInvertedIndexReader::query(...) inverted_index_reader.cpp:473
#1 doris::segment_v2::InvertedIndexIterator::read_from_inverted_index(...) inverted_index_reader.cpp:1237
apache#2 doris::vectorized::FunctionArraysOverlap::evaluate_inverted_index(...) function_arrays_overlap.h:192
apache#3 doris::vectorized::DefaultFunction::evaluate_inverted_index(...) function.h:532
apache#4 doris::vectorized::VExpr::_evaluate_inverted_index(...) vexpr.cpp:708
apache#5 doris::vectorized::VectorizedFnCall::evaluate_inverted_index(...) vectorized_fn_call.cpp:143
apache#6 doris::vectorized::VExprContext::evaluate_inverted_index(...) vexpr_context.cpp:126

```
  • Loading branch information
airborne12 authored Oct 9, 2024
1 parent 4602068 commit bc9b87d
Show file tree
Hide file tree
Showing 3 changed files with 642 additions and 22 deletions.
20 changes: 8 additions & 12 deletions be/src/vec/functions/array/function_arrays_overlap.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,18 @@ class FunctionArraysOverlap : public IFunction {
}
std::unique_ptr<InvertedIndexQueryParamFactory> query_param = nullptr;
const Array& query_val = param_value.get<Array>();
for (size_t i = 0; i < query_val.size(); ++i) {
Field nested_query_val = query_val[i];
for (auto nested_query_val : query_val) {
// any element inside array is NULL, return NULL
// by current arrays_overlap execute logic.
if (nested_query_val.is_null()) {
return Status::OK();
}
std::shared_ptr<roaring::Roaring> single_res = std::make_shared<roaring::Roaring>();
RETURN_IF_ERROR(InvertedIndexQueryParamFactory::create_query_value(
nested_param_type, &nested_query_val, query_param));
Status st = iter->read_from_inverted_index(
RETURN_IF_ERROR(iter->read_from_inverted_index(
data_type_with_name.first, query_param->get_value(),
segment_v2::InvertedIndexQueryType::EQUAL_QUERY, num_rows, single_res);
if (st.code() == ErrorCode::INVERTED_INDEX_NO_TERMS) {
// if analyzed param with no term, we do not filter any rows
// return all rows with OK status
roaring->addRange(0, num_rows);
break;
} else if (st != Status::OK()) {
return st;
}
segment_v2::InvertedIndexQueryType::EQUAL_QUERY, num_rows, single_res));
*roaring |= *single_res;
}

Expand Down
Loading

0 comments on commit bc9b87d

Please sign in to comment.