Skip to content

Commit f12788d

Browse files
committed
Use BtreeMap to make tests stable
1 parent 3460721 commit f12788d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

datafusion/optimizer/src/simplify_predicates.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use datafusion_common::{Column, Result, ScalarValue};
1919
use datafusion_expr::{BinaryExpr, Cast, Expr, Operator};
20-
use std::collections::HashMap;
20+
use std::collections::BTreeMap;
2121

2222
pub(crate) fn simplify_predicates(predicates: Vec<Expr>) -> Result<Vec<Expr>> {
2323
// Early return for simple cases
@@ -26,8 +26,8 @@ pub(crate) fn simplify_predicates(predicates: Vec<Expr>) -> Result<Vec<Expr>> {
2626
}
2727

2828
// Group predicates by their column reference
29-
let mut column_predicates: HashMap<Column, Vec<Expr>> =
30-
HashMap::with_capacity(predicates.len());
29+
let mut column_predicates: BTreeMap<Column, Vec<Expr>> =
30+
BTreeMap::new();
3131
let mut other_predicates = Vec::new();
3232

3333
for pred in predicates {

datafusion/sqllogictest/test_files/simplify_predicates.slt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ query TT
8484
EXPLAIN SELECT * FROM test_data WHERE str_col > 'apple' AND str_col > 'banana';
8585
----
8686
logical_plan
87-
01)Filter: test_data.str_col > Utf8("banana")
87+
01)Filter: test_data.str_col > Utf8View("banana")
8888
02)--TableScan: test_data projection=[int_col, float_col, str_col, date_col, bool_col]
8989

9090
# date_col > '2023-01-01' AND date_col > '2023-02-01' should simplify to date_col > '2023-02-01'
@@ -120,7 +120,7 @@ WHERE int_col > 5
120120
AND float_col BETWEEN 1 AND 100;
121121
----
122122
logical_plan
123-
01)Filter: test_data.str_col LIKE Utf8("A%") AND test_data.float_col >= Float32(1) AND test_data.float_col <= Float32(100) AND test_data.int_col > Int32(10)
123+
01)Filter: test_data.str_col LIKE Utf8View("A%") AND test_data.float_col >= Float32(1) AND test_data.float_col <= Float32(100) AND test_data.int_col > Int32(10)
124124
02)--TableScan: test_data projection=[int_col, float_col, str_col, date_col, bool_col]
125125

126126
statement ok

0 commit comments

Comments
 (0)