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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new ec521fc1c6d branch-4.1: [fix](be) Stabilize conjunct cost ordering 
#64637 (#64868)
ec521fc1c6d is described below

commit ec521fc1c6d93cc7850141cabcdee0efc6a89c23
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jun 26 14:18:00 2026 +0800

    branch-4.1: [fix](be) Stabilize conjunct cost ordering #64637 (#64868)
    
    Cherry-picked from #64637
    
    Co-authored-by: Pxl <[email protected]>
---
 be/src/exec/operator/operator.cpp               | 4 +++-
 be/src/exec/operator/scan_operator.cpp          | 3 ++-
 be/src/format/parquet/vparquet_group_reader.cpp | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/be/src/exec/operator/operator.cpp 
b/be/src/exec/operator/operator.cpp
index f8dfd0d9afd..1de468d82be 100644
--- a/be/src/exec/operator/operator.cpp
+++ b/be/src/exec/operator/operator.cpp
@@ -17,6 +17,8 @@
 
 #include "exec/operator/operator.h"
 
+#include <algorithm>
+
 #include "common/status.h"
 #include "exec/common/util.hpp"
 #include "exec/exchange/local_exchange_sink_operator.h"
@@ -231,7 +233,7 @@ Status OperatorXBase::prepare(RuntimeState* state) {
         RETURN_IF_ERROR(conjunct->prepare(state, intermediate_row_desc()));
     }
     if (state->enable_adjust_conjunct_order_by_cost()) {
-        std::ranges::sort(_conjuncts, [](const auto& a, const auto& b) {
+        std::ranges::stable_sort(_conjuncts, [](const auto& a, const auto& b) {
             return a->execute_cost() < b->execute_cost();
         });
     };
diff --git a/be/src/exec/operator/scan_operator.cpp 
b/be/src/exec/operator/scan_operator.cpp
index f4000a3c4d3..70ab35d1430 100644
--- a/be/src/exec/operator/scan_operator.cpp
+++ b/be/src/exec/operator/scan_operator.cpp
@@ -21,6 +21,7 @@
 #include <gen_cpp/Exprs_types.h>
 #include <gen_cpp/Metrics_types.h>
 
+#include <algorithm>
 #include <cstdint>
 #include <memory>
 
@@ -79,7 +80,7 @@ Status 
ScanLocalStateBase::update_late_arrival_runtime_filter(RuntimeState* stat
     RETURN_IF_ERROR(_helper.try_append_late_arrival_runtime_filter(state, 
_parent->row_descriptor(),
                                                                    
arrived_rf_num, _conjuncts));
     if (state->enable_adjust_conjunct_order_by_cost()) {
-        std::ranges::sort(_conjuncts, [](const auto& a, const auto& b) {
+        std::ranges::stable_sort(_conjuncts, [](const auto& a, const auto& b) {
             return a->execute_cost() < b->execute_cost();
         });
     };
diff --git a/be/src/format/parquet/vparquet_group_reader.cpp 
b/be/src/format/parquet/vparquet_group_reader.cpp
index f08840b919d..c24437e1048 100644
--- a/be/src/format/parquet/vparquet_group_reader.cpp
+++ b/be/src/format/parquet/vparquet_group_reader.cpp
@@ -266,7 +266,7 @@ Status RowGroupReader::init(
     }
     // _state is nullptr in some ut.
     if (_state && _state->enable_adjust_conjunct_order_by_cost()) {
-        std::ranges::sort(_filter_conjuncts, [](const auto& a, const auto& b) {
+        std::ranges::stable_sort(_filter_conjuncts, [](const auto& a, const 
auto& b) {
             return a->execute_cost() < b->execute_cost();
         });
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to