Skip to content

feat(bench): time-windowed b2/otel-demo arm measuring partition pruning - #118

Merged
jensholdgaard merged 1 commit into
mainfrom
feat/bench-b2-otel-demo-windowed
Jun 5, 2026
Merged

feat(bench): time-windowed b2/otel-demo arm measuring partition pruning#118
jensholdgaard merged 1 commit into
mainfrom
feat/bench-b2-otel-demo-windowed

Conversation

@jensholdgaard

@jensholdgaard jensholdgaard commented Jun 5, 2026

Copy link
Copy Markdown
Owner

What

The payoff of #117 (partition-level time pruning), measured on the real frozen otel-demo corpus: a time-windowed b2/otel-demo arm that demonstrates the inverted-index-collapse locality on real logs.

Why

The existing unwindowed b2/otel-demo query scans every partition — a template recurs across all hours on real logs (v4: 5/5 row groups). A query bounded to a time window should instead reach DataFusion with only the in-window partition(s); #117 made that possible. This arm measures it.

How

  • BuiltStore exposes min/max_time_unix_nano (the corpus's timestamp span) so the bench can pick a real window.
  • b2/otel-demo gains a corpus-window-1h arm: a query over the corpus's first hour that probes + asserts ≥1 partition is pruned before DataFusion, logs the pruning, and benches the windowed latency. Skipped for single-partition corpora (nothing to prune).

Indicative result on v4 (735,377 rows, 5 partitions; laptop, NOT §9)

query row groups DataFusion saw bytes read latency
unwindowed (busiest template) 5/5 5.5 MB 2.9 ms
1-hour window 1 (4 pruned at directory level) 267 KB 1.3 ms

~20× less data read — the time window bounds the scan to its partitions, not the corpus. (Latency improves less, ~2.2×, because at this scale the ~1 ms fixed per-query DataFusion overhead still dominates; the bytes-read pruning is what scales to GiB/TiB. v1 = single partition → arm skipped.)

This is the real-corpus wall-clock echo of the deterministic rfc0007_2_time_window_prunes_whole_partitions test from #117.

Verification

  • Probe assertion in the arm is the regression guard (a window that stops pruning fails the bench).
  • Local: cargo fmt --all --check, cargo clippy --workspace --all-targets --all-features -D warnings, cargo test --workspace all green; validated against the fetched corpus/otel-demo-v1 + -v4 release assets.

Part of epic #81 / #82. Follow-ups (not here): wire b1/otel-demo (severity + window), and a CI query-bench workflow that gh release downloads the corpus and runs b1/b2.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Enhanced benchmarking suite with windowed query performance testing, measuring query optimization for time-constrained requests.
    • Extended benchmark data collection to track timestamp boundaries, enabling more detailed performance analysis across corpus time ranges.

@jensholdgaard
jensholdgaard requested a review from Copilot June 5, 2026 06:47
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jensholdgaard, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 18 minutes and 7 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bcf1740a-6b67-4ae0-a5e7-ffc9dce018ab

📥 Commits

Reviewing files that changed from the base of the PR and between 2705040 and 3e1931b.

📒 Files selected for processing (2)
  • crates/ourios-bench/benches/b2.rs
  • crates/ourios-bench/src/store.rs
📝 Walkthrough

Walkthrough

PR adds time-span tracking to BuiltStore struct, then uses those bounds in an extended B2 benchmark that validates 1-hour windowed queries reduce row-group scans compared to unwindowed baselines.

Changes

Windowed Query Benchmark

Layer / File(s) Summary
Time span tracking in BuiltStore
crates/ourios-bench/src/store.rs
BuiltStore struct adds min_time_unix_nano and max_time_unix_nano fields. During record mining in build_query_store, non-zero timestamps are tracked to compute the corpus time bounds, which default to 0 if no timestamps are observed.
First-hour windowed benchmark validation
crates/ourios-bench/benches/b2.rs
B2 otel_demo benchmark now runs unwindowed corpus query, establishes a baseline row-group count, then conditionally executes a new "corpus-window-1h" arm via first_hour_window helper. The helper skips single-partition corpora or those with no timestamp span, constructs a 1-hour-windowed QueryRequest from the corpus bounds, probes it, asserts that DataFusion scanned strictly fewer row groups than baseline, logs pruning and byte-read metrics, and returns the windowed query for benchmarking.

Sequence Diagram

sequenceDiagram
  participant otel_demo
  participant first_hour_window
  participant build_query_store
  participant BuiltStore
  build_query_store->>build_query_store: track min_time_unix_nano, max_time_unix_nano
  build_query_store->>BuiltStore: populate time span fields
  otel_demo->>otel_demo: probe unwindowed corpus query, record baseline stats
  otel_demo->>first_hour_window: call with corpus and baseline row-groups
  first_hour_window->>first_hour_window: validate corpus (multi-file, non-zero span)
  first_hour_window->>first_hour_window: construct QueryRequest with 1-hour time_range
  first_hour_window->>first_hour_window: probe windowed query
  first_hour_window->>first_hour_window: assert windowed row-groups < baseline
  first_hour_window->>otel_demo: return windowed query
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • jensholdgaard/ourios#92: Directly related—this PR extends the existing B2 benchmark and BuiltStore output that were originally added in #92, adding time-span tracking and a new windowed-query benchmark arm.
  • jensholdgaard/ourios#117: The new "corpus-window-1h" benchmark constructs QueryRequest with a 1-hour time_range and expects fewer row-group scans, which depends on the pruning logic that handles request.time_range constraints.

Poem

🐰 Hopping through the hour-glass so fine,
We track the timestamps' earliest line,
Then window queries swift and tight,
Fewer row-groups scanned—pruning's might!
Time-bounded benchmarks, shining bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a time-windowed benchmark arm to measure partition pruning on the b2/otel-demo bench.
Description check ✅ Passed The description provides detailed context (What/Why/How), includes verification steps, and references related issues. It substantially covers the required sections.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/bench-b2-otel-demo-windowed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the ourios-bench harness to measure the payoff of RFC 0007 partition-level time-window pruning on the real otel-demo corpus by adding a 1-hour-windowed B2 benchmark arm and exposing the corpus timestamp span needed to pick a realistic window.

Changes:

  • Extend BuiltStore to track min_time_unix_nano / max_time_unix_nano while building the queryable Parquet store.
  • Add a new b2/otel-demo Criterion arm (corpus-window-1h) that probes a first-hour time window, asserts pruning, logs observed scan stats, and benchmarks the windowed query latency.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/ourios-bench/src/store.rs Track and expose the corpus time_unix_nano span in BuiltStore for benchmark window selection.
crates/ourios-bench/benches/b2.rs Add a new otel-demo windowed benchmark arm with a probe/assertion intended to guard partition pruning behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ourios-bench/benches/b2.rs Outdated
Comment thread crates/ourios-bench/benches/b2.rs
Comment thread crates/ourios-bench/benches/b2.rs
@jensholdgaard
jensholdgaard force-pushed the feat/bench-b2-otel-demo-windowed branch from 5651f78 to be331d2 Compare June 5, 2026 06:55
@jensholdgaard
jensholdgaard requested a review from Copilot June 5, 2026 06:55
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/benches/b2.rs
@jensholdgaard
jensholdgaard force-pushed the feat/bench-b2-otel-demo-windowed branch from be331d2 to 2705040 Compare June 5, 2026 09:58
@jensholdgaard
jensholdgaard requested a review from Copilot June 5, 2026 09:58
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/benches/b2.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/ourios-bench/src/store.rs (1)

172-194: ⚡ Quick win

Add colocated unit test for time span tracking.

The new min_time_unix_nano / max_time_unix_nano feature tracks corpus bounds by filtering out zero timestamps — this is non-trivial behavior (especially the all-zero edge case returning (0, 0)). The existing test only validates bucket reuse rejection. Consider adding a test that:

  1. Verifies min/max are captured from records with varying timestamps.
  2. Confirms zero timestamps are excluded from bounds.
  3. Covers the edge case where all timestamps are zero → (0, 0).

As per coding guidelines: "Unit tests must be colocated next to the code for anything non-trivial."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/ourios-bench/src/store.rs` around lines 172 - 194, Add colocated unit
tests in the existing tests module in this file that exercise the new
min_time_unix_nano and max_time_unix_nano behavior: write a corpus with records
having varying non-zero timestamps and assert build_query_store returns a store
whose min_time_unix_nano and max_time_unix_nano reflect the non-zero bounds;
write a corpus mixing zero and non-zero timestamps and assert zeros are excluded
from bounds; and write a corpus where every record has timestamp zero and assert
the returned bounds are (0, 0). Use the existing build_query_store helper and
BenchError match style to locate failures and keep tests next to the other tests
in the same tests module.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/ourios-bench/src/store.rs`:
- Around line 172-194: Add colocated unit tests in the existing tests module in
this file that exercise the new min_time_unix_nano and max_time_unix_nano
behavior: write a corpus with records having varying non-zero timestamps and
assert build_query_store returns a store whose min_time_unix_nano and
max_time_unix_nano reflect the non-zero bounds; write a corpus mixing zero and
non-zero timestamps and assert zeros are excluded from bounds; and write a
corpus where every record has timestamp zero and assert the returned bounds are
(0, 0). Use the existing build_query_store helper and BenchError match style to
locate failures and keep tests next to the other tests in the same tests module.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d8b140de-2f91-4b3e-966e-bc28768a64b0

📥 Commits

Reviewing files that changed from the base of the PR and between 8a3788d and 2705040.

📒 Files selected for processing (2)
  • crates/ourios-bench/benches/b2.rs
  • crates/ourios-bench/src/store.rs

@jensholdgaard
jensholdgaard force-pushed the feat/bench-b2-otel-demo-windowed branch from 2705040 to 80ca105 Compare June 5, 2026 10:13
@jensholdgaard
jensholdgaard requested a review from Copilot June 5, 2026 10:13
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/benches/b2.rs
@jensholdgaard
jensholdgaard force-pushed the feat/bench-b2-otel-demo-windowed branch from 80ca105 to 1869cd0 Compare June 5, 2026 10:32
@jensholdgaard
jensholdgaard requested a review from Copilot June 5, 2026 10:32
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/src/store.rs
The payoff of #117 (partition-level time pruning), measured on the real
frozen otel-demo corpus. The existing unwindowed b2/otel-demo query scans
every partition (a template recurs across all hours on real logs — v4: 5/5).
A query bounded to the corpus's first hour now reaches DataFusion with only
that hour's partition(s); the rest are pruned at the directory level, so the
scanned work tracks the WINDOW, not the corpus span.

- `BuiltStore` exposes `min/max_time_unix_nano` (the corpus's timestamp span)
  so the bench can pick a real window.
- `b2/otel-demo` adds a `corpus-window-1h` arm: a query over [first hour) that
  probes + asserts ≥1 partition is pruned before DataFusion, logs the pruning,
  and benches the windowed latency. Skipped for single-partition corpora.

Indicative on v4 (735,377 rows, 5 partitions; laptop, NOT §9):
  unwindowed: 5/5 row groups, 5.5 MB, 2.9 ms
  1h window:  1 row group (4 partitions pruned), 267 KB, 1.3 ms
→ ~20× less data read, the inverted-index-collapse locality on real logs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jensholdgaard
jensholdgaard force-pushed the feat/bench-b2-otel-demo-windowed branch from 1869cd0 to 3e1931b Compare June 5, 2026 10:40
@jensholdgaard
jensholdgaard requested a review from Copilot June 5, 2026 10:40
@jensholdgaard

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread crates/ourios-bench/benches/b2.rs
@jensholdgaard
jensholdgaard merged commit d0f50f5 into main Jun 5, 2026
11 checks passed
@jensholdgaard
jensholdgaard deleted the feat/bench-b2-otel-demo-windowed branch June 5, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants