xiaokang commented on code in PR #23581: URL: https://github.com/apache/doris/pull/23581#discussion_r1311765020
########## be/src/olap/like_column_predicate.cpp: ########## @@ -130,21 +138,24 @@ uint16_t LikeColumnPredicate::evaluate(const vectorized::IColumn& column, uint16 new_size += _opposite ^ flag; } } else { - auto* str_col = - vectorized::check_and_get_column<vectorized::PredicateColumnType<TYPE_STRING>>( - column); + const vectorized::PredicateColumnType<T>* str_col = + vectorized::check_and_get_column<vectorized::PredicateColumnType<T>>(column); + vectorized::ColumnUInt8::Container res(size, 0); - (_state->predicate_like_function)( Review Comment: the same problem as above ########## be/src/runtime/primitive_type.h: ########## @@ -91,6 +91,10 @@ constexpr bool is_string_type(PrimitiveType type) { return type == TYPE_CHAR || type == TYPE_VARCHAR || type == TYPE_STRING; } +constexpr bool is_variant_string_type(PrimitiveType type) { Review Comment: variant string is ambiguous to variant type. can we use is_var_string_type or is_varchar_type ########## be/src/olap/like_column_predicate.cpp: ########## @@ -83,18 +91,18 @@ uint16_t LikeColumnPredicate::evaluate(const vectorized::IColumn& column, uint16 } } } else { - auto* str_col = - vectorized::check_and_get_column<vectorized::PredicateColumnType<TYPE_STRING>>( - nested_col); + auto* str_col = vectorized::check_and_get_column<vectorized::PredicateColumnType<T>>( + nested_col); if (!nullable_col->has_null()) { vectorized::ColumnUInt8::Container res(size, 0); - (_state->predicate_like_function)( Review Comment: batch substring optimization may be missed if it's moved to for loop ########## be/src/vec/columns/predicate_column.h: ########## @@ -154,8 +153,16 @@ class PredicateColumnType final : public COWHelper<IColumn, PredicateColumnType< size_t size() const override { return data.size(); } - [[noreturn]] StringRef get_data_at(size_t n) const override { - LOG(FATAL) << "get_data_at not supported in PredicateColumnType"; + StringRef get_data_at(size_t n) const override { + if constexpr (std::is_same_v<T, StringRef>) { + auto res = reinterpret_cast<const StringRef&>(data[n]); + if constexpr (Type == TYPE_CHAR) { + res.size = strnlen(res.data, res.size); Review Comment: strnlen may be less then CHAR schema length. -- 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