HappenLee commented on code in PR #63389:
URL: https://github.com/apache/doris/pull/63389#discussion_r3394257778
##########
be/src/exprs/function/function_string.cpp:
##########
@@ -1341,8 +1349,93 @@ using FunctionCrc32 = FunctionUnaryToType<Crc32Impl,
NameCrc32>;
using FunctionStringUTF8Length = FunctionUnaryToType<StringUtf8LengthImpl,
NameStringUtf8Length>;
using FunctionStringSpace = FunctionUnaryToType<StringSpace, NameStringSpace>;
using FunctionIsValidUTF8 = FunctionUnaryToType<IsValidUTF8Impl,
NameIsValidUTF8>;
-using FunctionStringStartsWith =
- FunctionBinaryToType<DataTypeString, DataTypeString,
StringStartsWithImpl, NameStartsWith>;
+
+class FunctionStringStartsWith : public FunctionBinaryToType<DataTypeString,
DataTypeString,
+
StringStartsWithImpl, NameStartsWith> {
+public:
+ static FunctionPtr create() { return
std::make_shared<FunctionStringStartsWith>(); }
+
+ ZoneMapFilterResult evaluate_zonemap_filter(const ZoneMapEvalContext& ctx,
+ const VExprSPtrs& arguments)
const override {
+ auto slot_literal = expr_zonemap::extract_slot_and_literal(arguments);
+ DORIS_CHECK(slot_literal.has_value());
+ DORIS_CHECK(!slot_literal->literal_on_left);
+ DORIS_CHECK(!slot_literal->literal.is_null());
+ DORIS_CHECK(slot_literal->slot_type != nullptr);
+ DORIS_CHECK(slot_literal->literal_type != nullptr);
+
DORIS_CHECK(is_string_type(remove_nullable(slot_literal->slot_type)->get_primitive_type()));
+ DORIS_CHECK(
+
is_string_type(remove_nullable(slot_literal->literal_type)->get_primitive_type()));
+
+ auto slot_type = expr_zonemap::fetch_compatible_slot_type(ctx,
slot_literal->slot_index,
+
slot_literal->slot_type);
+ if (slot_type == nullptr) {
+ return ZoneMapFilterResult::kUnsupported;
+ }
+ const auto* zone_map_ref = expr_zonemap::fetch_zone_map(ctx,
slot_literal->slot_index);
+ if (zone_map_ref == nullptr) {
+ return ZoneMapFilterResult::kUnsupported;
+ }
+ const auto& zone_map = *zone_map_ref;
+ if (!zone_map.has_not_null) {
+ return ZoneMapFilterResult::kNoMatch;
+ }
+ if (!expr_zonemap::range_stats_usable_for_zonemap(zone_map,
slot_type)) {
+ return unsupported_zonemap_filter(ctx);
+ }
+
+ const auto prefix = slot_literal->literal.as_string_view();
Review Comment:
这个是不是可以放到这个can_evaluate_zonemap_filter里面直接判断了
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]