Skip to content

Split the Binary scalar function into Compare, Boolean, and Numeric - #11818

Open
robert3005 wants to merge 2 commits into
developfrom
rk/split-binary-fn
Open

robert3005 wants to merge 2 commits into
developfrom
rk/split-binary-fn

Conversation

@robert3005

Copy link
Copy Markdown
Contributor

Binary held comparison, Kleene boolean, and arithmetic operators behind one Operator enum, so each kernel, rule, and integration had to match on the operator to learn which kind of function it had. Options that apply to only one kind, such as the float order of a comparison in #11401, had no clean place. There are now three functions, each with its own operator type: Compare (vortex.compare, CompareOperator), Boolean (vortex.boolean, BooleanOperator), and Numeric (vortex.numeric, NumericOperator).

Most of the diff is mechanical. The parts to review are the three vtables in vortex-array/src/scalar_fn/builtin/{compare,boolean,numeric}/mod.rs, the legacy reader in builtin/binary.rs, and the stats rewrite rules in vortex-expr, where the two Binary rules became one pair for Compare and one pair for Boolean.

Breaking changes:

  • Binary, the mixed Operator enum, ArrayBuiltins::binary, ExprBuiltins::binary, expr::binary, expr::bound::binary, and the module path scalar_fn::builtin::binary are removed. Use compare, boolean, and numeric in their place. Kernel traits are now in builtin::compare and builtin::boolean, and BooleanKernel::boolean takes a BooleanOperator.
  • Serialized expressions use the new ids. An expression that an older version wrote as vortex.binary still loads: a legacy plugin reads BinaryOpts and returns the function that now owns the operator. An older Vortex version cannot read an expression that this version writes.
  • NumericOperator now displays as +, -, *, /, as Operator did.

The C, Java, and Python operator surfaces do not change. A new test checks that each of the 12 legacy operators loads as the correct function. vortex-cuda and vortex-python-cuda were not compiled locally, and the Java tests were not run.

🤖 Generated with Claude Code

`Binary` held comparison, Kleene boolean, and arithmetic operators behind
one `Operator` enum, so each caller had to match on the operator to learn
the kind of function. There are now three functions, each with its own
operator type: `Compare` (`vortex.compare`), `Boolean` (`vortex.boolean`),
and `Numeric` (`vortex.numeric`).

Expressions that an older version serialized as `vortex.binary` still
load. A legacy plugin reads `BinaryOpts` and returns the function that
now owns the operator.

Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005 robert3005 added the changelog/break A breaking API change label Nov 23, 2026
@codspeed

codspeed Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 48.23%

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

❌ 3 regressed benchmarks
✅ 2015 untouched benchmarks
🆕 8 new benchmarks
⏩ 144 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation random_i128[0.01] 8.5 µs 38.4 µs -77.86%
❌ CPU Simulation random_i128[0.5] 98.7 µs 126.9 µs -22.23%
❌ CPU Simulation random_i128[0.8] 123.7 µs 153.5 µs -19.4%
🆕 CPU Simulation probe_scalar_fn_once[vortex.boolean(bool?, len=100000)] N/A 243.1 µs N/A
🆕 CPU Simulation probe_scalar_fn_once[vortex.numeric(i64?, len=100000)] N/A 620.2 µs N/A
🆕 CPU Simulation probe_scalar_fn_repeated[vortex.boolean(bool?, len=100000)] N/A 246.6 µs N/A
🆕 CPU Simulation probe_scalar_fn_repeated[vortex.numeric(i64?, len=100000)] N/A 635.7 µs N/A
🆕 CPU Simulation probe_scalar_fn_valid_once[vortex.boolean(bool?, len=100000)] N/A 288.7 µs N/A
🆕 CPU Simulation probe_scalar_fn_valid_once[vortex.numeric(i64?, len=100000)] N/A 326.1 µs N/A
🆕 CPU Simulation probe_scalar_fn_valid_repeated[vortex.boolean(bool?, len=100000)] N/A 192.2 µs N/A
🆕 CPU Simulation probe_scalar_fn_valid_repeated[vortex.numeric(i64?, len=100000)] N/A 58 µs N/A

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/split-binary-fn (cc72846) with develop (cebee2f)

Open in CodSpeed

Footnotes

  1. 144 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Signed-off-by: Robert Kruszewski <github@robertk.io>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant