You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by pa...@apache.org on 2026/01/19 10:32:06 UTC

(doris) branch tpc_preview_xl created (now 2bc6a1a3797)

This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a change to branch tpc_preview_xl
in repository https://gitbox.apache.org/repos/asf/doris.git


      at 2bc6a1a3797 adjust conjunct order by execute cost

This branch includes the following new commits:

     new 2bc6a1a3797 adjust conjunct order by execute cost

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


(doris) 01/01: adjust conjunct order by execute cost

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a commit to branch tpc_preview_xl
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 2bc6a1a37970fbcdc4e5b4331c63b74b96ae1919
Author: BiteTheDDDDt <xl...@selectdb.com>
AuthorDate: Mon Jan 19 18:31:45 2026 +0800

    adjust conjunct order by execute cost
---
 be/src/vec/exec/format/parquet/vparquet_group_reader.cpp | 3 +++
 be/src/vec/exprs/vectorized_fn_call.cpp                  | 4 ++++
 be/src/vec/exprs/vectorized_fn_call.h                    | 1 +
 be/src/vec/exprs/vexpr.h                                 | 8 ++++++++
 be/src/vec/exprs/vexpr_context.cpp                       | 4 ++++
 be/src/vec/exprs/vexpr_context.h                         | 2 ++
 be/src/vec/exprs/vruntimefilter_wrapper.h                | 2 ++
 be/src/vec/functions/function.h                          | 2 ++
 be/src/vec/functions/functions_comparison.h              | 2 ++
 9 files changed, 28 insertions(+)

diff --git a/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp b/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp
index d57264c1987..61d0956ad7f 100644
--- a/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp
+++ b/be/src/vec/exec/format/parquet/vparquet_group_reader.cpp
@@ -192,6 +192,9 @@ Status RowGroupReader::init(
                                  _lazy_read_ctx.missing_columns_conjuncts.end());
         RETURN_IF_ERROR(_rewrite_dict_predicates());
     }
+    std::ranges::sort(_filter_conjuncts, [](const VExprContextSPtr& a, const VExprContextSPtr& b) {
+        return a->execute_cost() < b->execute_cost();
+    });
     return Status::OK();
 }
 
diff --git a/be/src/vec/exprs/vectorized_fn_call.cpp b/be/src/vec/exprs/vectorized_fn_call.cpp
index 591bb88cf8b..439b5c5caaf 100644
--- a/be/src/vec/exprs/vectorized_fn_call.cpp
+++ b/be/src/vec/exprs/vectorized_fn_call.cpp
@@ -641,5 +641,9 @@ Status VectorizedFnCall::evaluate_ann_range_search(
     return Status::OK();
 }
 
+double VectorizedFnCall::execute_cost() const {
+    return _function->execute_cost();
+}
+
 #include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/vectorized_fn_call.h b/be/src/vec/exprs/vectorized_fn_call.h
index 78ccd56f7b6..0307a2b378f 100644
--- a/be/src/vec/exprs/vectorized_fn_call.h
+++ b/be/src/vec/exprs/vectorized_fn_call.h
@@ -65,6 +65,7 @@ public:
     const std::string& expr_name() const override;
     std::string function_name() const;
     std::string debug_string() const override;
+    double execute_cost() const override;
     bool is_blockable() const override {
         return _function->is_blockable() ||
                std::any_of(_children.begin(), _children.end(),
diff --git a/be/src/vec/exprs/vexpr.h b/be/src/vec/exprs/vexpr.h
index 3b899d4e8aa..7cfe9430727 100644
--- a/be/src/vec/exprs/vexpr.h
+++ b/be/src/vec/exprs/vexpr.h
@@ -271,6 +271,14 @@ public:
         return expr;
     }
 
+    virtual double execute_cost() const {
+        double cost = 1.0;
+        for (const auto& child : _children) {
+            cost += child->execute_cost();
+        }
+        return cost;
+    }
+
     // If this expr is a RuntimeFilterWrapper, this method will return an underlying rf expression
     virtual VExprSPtr get_impl() const { return {}; }
 
diff --git a/be/src/vec/exprs/vexpr_context.cpp b/be/src/vec/exprs/vexpr_context.cpp
index 2a9c049e303..39a1e09c1b0 100644
--- a/be/src/vec/exprs/vexpr_context.cpp
+++ b/be/src/vec/exprs/vexpr_context.cpp
@@ -452,5 +452,9 @@ uint64_t VExprContext::get_digest(uint64_t seed) const {
     return _root->get_digest(seed);
 }
 
+double VExprContext::execute_cost() const {
+    return _root->execute_cost();
+}
+
 #include "common/compile_check_end.h"
 } // namespace doris::vectorized
diff --git a/be/src/vec/exprs/vexpr_context.h b/be/src/vec/exprs/vexpr_context.h
index 349f199af23..57136f49c78 100644
--- a/be/src/vec/exprs/vexpr_context.h
+++ b/be/src/vec/exprs/vexpr_context.h
@@ -178,6 +178,8 @@ public:
     [[nodiscard]] const std::string& expr_name() const;
     [[nodiscard]] bool is_blockable() const;
 
+    double execute_cost() const;
+
     VExprSPtr root() { return _root; }
     void set_root(const VExprSPtr& expr) { _root = expr; }
     void set_index_context(std::shared_ptr<IndexExecContext> index_context) {
diff --git a/be/src/vec/exprs/vruntimefilter_wrapper.h b/be/src/vec/exprs/vruntimefilter_wrapper.h
index 09bc8a815c7..a630d58d82e 100644
--- a/be/src/vec/exprs/vruntimefilter_wrapper.h
+++ b/be/src/vec/exprs/vruntimefilter_wrapper.h
@@ -63,6 +63,8 @@ public:
     const std::string& expr_name() const override;
     const VExprSPtrs& children() const override { return _impl->children(); }
 
+    double execute_cost() const override { return _impl->execute_cost(); }
+
     Status execute_filter(VExprContext* context, const Block* block,
                           uint8_t* __restrict result_filter_data, size_t rows, bool accept_null,
                           bool* can_filter_all) const override;
diff --git a/be/src/vec/functions/function.h b/be/src/vec/functions/function.h
index 3c9c389aa8a..51daeff2168 100644
--- a/be/src/vec/functions/function.h
+++ b/be/src/vec/functions/function.h
@@ -167,6 +167,8 @@ public:
     virtual const DataTypes& get_argument_types() const = 0;
     virtual const DataTypePtr& get_return_type() const = 0;
 
+    virtual double execute_cost() const { return 1.0; }
+
     /// Do preparations and return executable.
     /// sample_block should contain data types of arguments and values of constants, if relevant.
     virtual PreparedFunctionPtr prepare(FunctionContext* context, const Block& sample_block,
diff --git a/be/src/vec/functions/functions_comparison.h b/be/src/vec/functions/functions_comparison.h
index 2f5a5088af6..244f32f60e0 100644
--- a/be/src/vec/functions/functions_comparison.h
+++ b/be/src/vec/functions/functions_comparison.h
@@ -271,6 +271,8 @@ public:
 
     FunctionComparison() = default;
 
+    double execute_cost() const override { return 0.1; }
+
 private:
     template <PrimitiveType PT>
     Status execute_num_type(Block& block, uint32_t result, const ColumnPtr& col_left_ptr,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org