From 918750ca578f69ddee9d1d429424fee9e2797d14 Mon Sep 17 00:00:00 2001 From: Lloyd-Pottiger Date: Tue, 23 May 2023 10:12:17 +0800 Subject: [PATCH] fix Signed-off-by: Lloyd-Pottiger --- dbms/src/Flash/Coprocessor/TiDBTableScan.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbms/src/Flash/Coprocessor/TiDBTableScan.cpp b/dbms/src/Flash/Coprocessor/TiDBTableScan.cpp index a5aa5ded6bc..d73c4643bbf 100644 --- a/dbms/src/Flash/Coprocessor/TiDBTableScan.cpp +++ b/dbms/src/Flash/Coprocessor/TiDBTableScan.cpp @@ -28,7 +28,9 @@ TiDBTableScan::TiDBTableScan( , pushed_down_filters(is_partition_table_scan ? std::move(table_scan->partition_table_scan().pushed_down_filter_conditions()) : std::move(table_scan->tbl_scan().pushed_down_filter_conditions())) // Only No-partition table need keep order when tablescan executor required keep order. // If keep_order is not set, keep order for safety. - , keep_order(!is_partition_table_scan && (table_scan->tbl_scan().keep_order() || !table_scan->tbl_scan().has_keep_order())) + // When keep_order is true, we will not push down filters to tablescan. + // So even if keep_order is not set, but pushed down filters is not empty, we can't keep order. + , keep_order(!is_partition_table_scan && pushed_down_filters.empty() && (!table_scan->tbl_scan().has_keep_order() || table_scan->tbl_scan().keep_order())) , is_fast_scan(table_scan->tbl_scan().is_fast_scan()) { if (is_partition_table_scan)