HappenLee commented on code in PR #11468:
URL: https://github.com/apache/doris/pull/11468#discussion_r938584865


##########
be/src/vec/exec/volap_scan_node.cpp:
##########
@@ -2019,4 +1343,530 @@ Status VOlapScanNode::get_hints(TabletSharedPtr table, 
const TPaloScanRange& sca
     return Status::OK();
 }
 
+template <bool IsNotIn>
+bool VOlapScanNode::_should_push_down_in_predicate(VInPredicate* pred, 
VExprContext* expr_ctx) {
+    if (pred->is_not_in() != IsNotIn) {
+        return false;
+    }
+    InState* state = reinterpret_cast<InState*>(
+            expr_ctx->fn_context(pred->fn_context_index())
+                    ->get_function_state(FunctionContext::FRAGMENT_LOCAL));
+    HybridSetBase* set = state->hybrid_set.get();
+
+    // if there are too many elements in InPredicate, exceed the limit,
+    // we will not push any condition of this column to storage engine.
+    // because too many conditions pushed down to storage engine may even
+    // slow down the query process.
+    // ATTN: This is just an experience value. You may need to try
+    // different thresholds to improve performance.
+    if (set->size() > _max_pushdown_conditions_per_column) {
+        VLOG_NOTICE << "Predicate value num " << set->size() << " exceed limit 
"
+                    << _max_pushdown_conditions_per_column;
+        return false;
+    }
+    return true;
+}
+
+bool VOlapScanNode::_should_push_down_function(
+        VectorizedFnCall* fn_call, const std::function<bool(const 
std::string&)>& fn_checker) {
+    return fn_checker(fn_call->fn().name.function_name);
+}
+
+bool VOlapScanNode::_should_push_down_function_filter(VectorizedFnCall* 
fn_call,
+                                                      VExprContext* expr_ctx,
+                                                      std::string* 
constant_str,
+                                                      
doris_udf::FunctionContext** fn_ctx) {
+    if (fn_call->fn().name.function_name != "like") {
+        return false;
+    }
+
+    auto children = fn_call->children();
+    doris_udf::FunctionContext* func_cxt = 
expr_ctx->fn_context(fn_call->fn_context_index());
+    if (!func_cxt) {
+        return false;
+    }
+    if (children.size() != 2) {
+        return false;
+    }
+    for (size_t i = 0; i < children.size(); i++) {
+        if (VExpr::expr_without_cast(children[i])->node_type() != 
TExprNodeType::SLOT_REF) {
+            // not a slot ref(column)
+            continue;
+        }
+        if (!children[1 - i]->is_constant()) {
+            // only handle constant value
+            return false;
+        } else if (children[1 - i]->type().is_string_type()) {

Review Comment:
   why the `like` the other child is not string?



-- 
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

Reply via email to