Skip to content

Add built-in stats rewrite rules#7935

Open
gatesn wants to merge 2 commits into
ngates/stats-7707/typed-stats-rewrite-apifrom
ngates/stats-7707/built-in-rewrite-rules
Open

Add built-in stats rewrite rules#7935
gatesn wants to merge 2 commits into
ngates/stats-7707/typed-stats-rewrite-apifrom
ngates/stats-7707/built-in-rewrite-rules

Conversation

@gatesn
Copy link
Copy Markdown
Contributor

@gatesn gatesn commented May 14, 2026

Summary

  • register built-in stats rewrite rules through the session-backed registry
  • port comparison, boolean, between, like, list_contains, and cast-aware stat rewrites to StatFn::new_expr(...)
  • add aggregate-backed null rewrite rules using all_null and all_non_null
  • keep the existing legacy null_count / row_count() rewrite rules so current stored stats continue to work

Tests

  • cargo +nightly fmt --all
  • cargo test -p vortex-array stats::rewrite::builtins::tests::rewrites_null
  • cargo test -p vortex-array stats::rewrite
  • cargo clippy --all-targets --all-features

@gatesn gatesn added the changelog/feature A new feature label May 14, 2026
@gatesn gatesn changed the title 5: Add built-in stats rewrite rules Add built-in stats rewrite rules May 14, 2026
@gatesn gatesn force-pushed the ngates/stats-7707/min-max-aggregate-fns branch from 988447b to b22ebfe Compare May 14, 2026 22:32
@gatesn gatesn force-pushed the ngates/stats-7707/built-in-rewrite-rules branch from dfce840 to b08d3d5 Compare May 14, 2026 22:34
@gatesn gatesn mentioned this pull request May 14, 2026
39 tasks
@gatesn gatesn force-pushed the ngates/stats-7707/min-max-aggregate-fns branch from b22ebfe to c1e72a3 Compare May 14, 2026 23:02
@gatesn gatesn force-pushed the ngates/stats-7707/built-in-rewrite-rules branch from b08d3d5 to 410ff05 Compare May 14, 2026 23:02
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 14, 2026

Merging this PR will improve performance by 12.35%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 4 improved benchmarks
✅ 1212 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation encode_varbin[(1000, 2)] 168 µs 148.2 µs +13.36%
Simulation encode_varbin[(1000, 32)] 175 µs 155.4 µs +12.62%
Simulation encode_varbin[(1000, 4)] 168.9 µs 149.4 µs +13.06%
Simulation encode_varbin[(1000, 8)] 165.8 µs 150.2 µs +10.37%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ngates/stats-7707/built-in-rewrite-rules (ad61595) with develop (1f6fb0a)1

Open in CodSpeed

Footnotes

  1. No successful run was found on ngates/stats-7707/min-max-aggregate-fns (aa967fc) during the generation of this report, so develop (1f6fb0a) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@gatesn gatesn marked this pull request as ready for review May 15, 2026 00:13
@gatesn gatesn requested a review from robert3005 May 15, 2026 00:13
@gatesn gatesn force-pushed the ngates/stats-7707/built-in-rewrite-rules branch 2 times, most recently from 5cdafee to 9700eec Compare May 15, 2026 03:51
@gatesn gatesn force-pushed the ngates/stats-7707/min-max-aggregate-fns branch from c1e72a3 to 4f74bb3 Compare May 15, 2026 03:51
@gatesn gatesn force-pushed the ngates/stats-7707/built-in-rewrite-rules branch from 9700eec to bc790ff Compare May 15, 2026 09:16
@gatesn gatesn force-pushed the ngates/stats-7707/min-max-aggregate-fns branch from 4f74bb3 to 78f93f1 Compare May 15, 2026 09:16
gatesn added 2 commits May 15, 2026 10:20
Signed-off-by: Nicholas Gates <nick@nickgates.com>
Signed-off-by: Nicholas Gates <nick@nickgates.com>
@gatesn gatesn force-pushed the ngates/stats-7707/built-in-rewrite-rules branch from bc790ff to ad61595 Compare May 15, 2026 09:23
@gatesn gatesn force-pushed the ngates/stats-7707/min-max-aggregate-fns branch from 78f93f1 to aa967fc Compare May 15, 2026 09:23
@gatesn gatesn force-pushed the ngates/stats-7707/min-max-aggregate-fns branch from aa967fc to d963a44 Compare May 17, 2026 15:51
@gatesn gatesn changed the base branch from ngates/stats-7707/min-max-aggregate-fns to ngates/stats-7707/typed-stats-rewrite-api May 17, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants