Skip to content

Conversation

pepijnve
Copy link
Contributor

@pepijnve pepijnve commented Oct 17, 2025

Which issue does this PR close?

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

@github-actions github-actions bot added the physical-expr Changes to the physical-expr crates label Oct 17, 2025
// Many when/then branches where all but the first few are effectively unreachable
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| {
let when_thens = (0..batch.num_rows() as i32).map(|i| (make_x_cmp_y(&c1, Operator::Eq, i * 1000), lit(i))).collect();
let when_thens = (0..batch.num_rows() as i32).map(|i| (make_x_cmp_y(&c1, Operator::Lt, i * 1000), lit(i))).collect();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I missed this in the initial review

Copy link
Contributor Author

@pepijnve pepijnve Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfectly understandable. With the sheer number of PRs you're reviewing it's easy to miss something small like this.

I was focusing (or trying to at least) on this and missed the copy/paste mistake myself as author. It only became apparent when the unexpected results showed up.
Clearly trying to do too many things at the same time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearly trying to do too many things at the same time.

Indeed -- story of my (current) life!

@alamb alamb changed the title Use < instead of = in case benchmark predicates Use < instead of = in case benchmark predicates, use Integers Oct 18, 2025
@alamb alamb added this pull request to the merge queue Oct 18, 2025
Merged via the queue into apache:main with commit 0ddc82e Oct 18, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants