BiteTheDDDDt commented on code in PR #11985: URL: https://github.com/apache/doris/pull/11985#discussion_r954736171
########## be/src/olap/in_list_predicate.h: ########## @@ -181,6 +188,60 @@ class InListPredicateBase : public ColumnPredicate { LOG(FATAL) << "IColumn not support in_list_predicate.evaluate_or now."; } + bool evaluate_and(const std::pair<WrapperField*, WrapperField*>& statistic) const override { + if (statistic.first == nullptr || statistic.second == nullptr) { + return true; + } + if (statistic.first->is_null()) { + return true; + } + if constexpr (PT == PredicateType::IN_LIST) { + if constexpr (Type == TYPE_DATE) { + T tmp_min_uint32_value = 0; + memcpy((char*)(&tmp_min_uint32_value), statistic.first->cell_ptr(), + sizeof(uint24_t)); + T tmp_max_uint32_value = 0; + memcpy((char*)(&tmp_max_uint32_value), statistic.second->cell_ptr(), + sizeof(uint24_t)); + return tmp_min_uint32_value <= _max_value && tmp_max_uint32_value >= _min_value; + } else if constexpr (std::is_same_v<T, StringValue>) { + auto min = reinterpret_cast<const Slice*>(statistic.first->cell_ptr()); + auto max = reinterpret_cast<const Slice*>(statistic.second->cell_ptr()); + return StringValue(min->data, min->size) <= _max_value && + StringValue(max->data, max->size) >= _min_value; + } else { + return *reinterpret_cast<const T*>(statistic.first->cell_ptr()) <= _max_value && + *reinterpret_cast<const T*>(statistic.second->cell_ptr()) >= _min_value; + } + } else { + return true; + } + } + + bool evaluate_and(const segment_v2::BloomFilter* bf) const override { + if constexpr (PT == PredicateType::IN_LIST) { + for (auto value : _values) { + bool existed = false; + if constexpr (std::is_same_v<T, StringValue>) { + existed = bf->test_bytes(value.ptr, value.len); Review Comment: maybe we can remove `existed` and return directly -- 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