You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use < instead of = in case benchmark predicates, use Integers (#18144)
## Which issue does this PR close?
- Followup to #18097
## Rationale for this change
The last benchmark was incorrectly essentially indentical to the second
to last one. The actual predicate was using `=` instead of `<`.
## What changes are included in this PR?
- Adjust the operator in the case predicates to `<`
- Adds two additional benchmarks covering `case x when ...`
## Are these changes tested?
Verified with debugger.
## Are there any user-facing changes?
No
// Many when/then branches where all but the first few are effectively unreachable
195
191
c.bench_function(format!("case_when {}x{}: CASE WHEN c1 < 0 THEN 0 WHEN c1 < 1000 THEN 1 ... WHEN c1 < n * 1000 THEN n ELSE n + 1 END", batch.num_rows(), batch.num_columns()).as_str(), |b| {
196
-
let when_thens = (0..batch.num_rows()asi32).map(|i| (make_x_cmp_y(&c1,Operator::Eq, i *1000),lit(i))).collect();
192
+
let when_thens = (0..batch.num_rows()asi32).map(|i| (make_x_cmp_y(&c1,Operator::Lt, i *1000),lit(i))).collect();
// Many when/then branches where all are effectively reachable
205
+
c.bench_function(format!("case_when {}x{}: CASE c1 WHEN 0 THEN 0 WHEN 1 THEN 1 ... WHEN n THEN n ELSE n + 1 END", batch.num_rows(), batch.num_columns()).as_str(), |b| {
206
+
let when_thens = (0..batch.num_rows()asi32).map(|i| (lit(i),lit(i))).collect();
// Many when/then branches where all but the first few are effectively unreachable
219
+
c.bench_function(format!("case_when {}x{}: CASE c2 WHEN 0 THEN 0 WHEN 1000 THEN 1 ... WHEN n * 1000 THEN n ELSE n + 1 END", batch.num_rows(), batch.num_columns()).as_str(), |b| {
220
+
let when_thens = (0..batch.num_rows()asi32).map(|i| (lit(i *1000),lit(i))).collect();
0 commit comments