amorynan commented on code in PR #41286: URL: https://github.com/apache/doris/pull/41286#discussion_r1779664432
########## be/src/vec/functions/array/function_arrays_overlap.h: ########## @@ -128,6 +129,87 @@ class FunctionArraysOverlap : public IFunction { return make_nullable(std::make_shared<DataTypeUInt8>()); } + /** + * eval inverted index. we can filter array rows with inverted index iter + * array_overlap(array, []) -> array_overlap(array, const value) + */ + Status evaluate_inverted_index( + const ColumnsWithTypeAndName& arguments, + const std::vector<vectorized::IndexFieldNameAndTypePair>& data_type_with_names, + std::vector<segment_v2::InvertedIndexIterator*> iterators, uint32_t num_rows, + segment_v2::InvertedIndexResultBitmap& bitmap_result) const override { + DCHECK(arguments.size() == 1); + DCHECK(data_type_with_names.size() == 1); + DCHECK(iterators.size() == 1); + auto* iter = iterators[0]; + if (iter == nullptr) { + return Status::OK(); + } + auto data_type_with_name = data_type_with_names[0]; + if (iter->get_inverted_index_reader_type() == + segment_v2::InvertedIndexReaderType::FULLTEXT) { + return Status::Error<ErrorCode::INVERTED_INDEX_EVALUATE_SKIPPED>( + "Inverted index evaluate skipped, FULLTEXT reader can not support " + "array_overlap"); + } + // in arrays_overlap param is array Field and const Field + ColumnPtr arg_column = arguments[0].column; + DataTypePtr arg_type = arguments[0].type; + if ((is_column_nullable(*arg_column) && !is_column_const(*remove_nullable(arg_column))) || + !is_column_const(*arg_column)) { Review Comment: done ! -- 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