Skip to content

refactor: remove the row-reference oracle and share devtools corpus helpers, part 2 (#1046) - #1078

Merged
milindsrivastava1997 merged 1 commit into
mainfrom
1046-b-row-reference-oracle-corpus-helpers
Oct 30, 2026
Merged

milindsrivastava1997 merged 1 commit into
mainfrom
1046-b-row-reference-oracle-corpus-helpers

Conversation

@milindsrivastava1997

@milindsrivastava1997 milindsrivastava1997 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Part 2 of #1046; part 1 was #1069. With this PR, #1046 is done except for the cross-crate test-only items, which moved to #1057.

Why

  • The row-at-a-time reference operators exist only to check that the columnar operators match them. That check was there for the columnar conversion, which is finished. The oracle never says what an operator should return; it only compares against the old code.
  • Four devtools tools each kept their own copy of the corpus helpers, and the bgp_catalog copies had drifted apart.

What

  • executor:
  • devtools:
    • Adds a new asap_devtools::corpora module holding sql_statements, promql_lines, dqc_catalog, netflow_catalog, bgp_catalog and parse_sample_interval.
    • sketch_coverage, variant_coverage, analyze_corpora and examples/canonical_examples use the module instead of their own copies.
    • sketch_coverage stays a separate binary; it is not merged into variant_coverage.

How

bgp_catalog is the union of the four old copies:

sketch_/variant_coverage analyze_corpora canonical_examples corpora::bgp_catalog
bgp_updates columns 7 16 3 16
bgp_rib_state 5 columns missing 3 columns 5 columns
bgp.-prefixed names both updates only none both

bgp_analytics.sql reads bgp.bgp_rib_state and origin, and the jan2024 workload reads all 16 update columns. None of the old copies covered all of these.

Key code interfaces added / modified

// crates/devtools/src/corpora.rs (new module, pub in asap-devtools)
/// Statements of a SQL corpus: `#`/`--` comment lines dropped, split on `;`.
pub fn sql_statements(corpus: &str) -> Vec<String>;                 // new
/// Queries of a PromQL corpus: one per non-empty, non-`#` line.
pub fn promql_lines(corpus: &str) -> impl Iterator<Item = &str>;    // new
pub fn dqc_catalog() -> SqlCatalog;                                  // new
pub fn netflow_catalog() -> SqlCatalog;                              // new
/// Union of the former per-tool copies (table above).
pub fn bgp_catalog() -> SqlCatalog;                                  // new
/// The required `--sample-interval-ms` CLI argument.
pub fn parse_sample_interval() -> u64;                               // new

All the executor items removed here are pub(crate) or narrower and #[cfg(test)].

Major algorithm changes

None.

Before this PR

  • Every converted operator ran a second time under with_row_reference in tests.
  • Each corpus tool lowered BGP queries against its own catalog.

After this PR

  • Operator tests run only the columnar operators.
  • All corpus tools share one catalog per corpus.

Evidence

On variant_coverage, sketch_coverage (--sample-interval-ms 1000) and analyze_corpora --sql-corpora, I compared the outputs before and after this PR:

  • The coverage reports are byte-identical.
  • The analyze_corpora dumps are identical, apart from one DataFusion "did you mean" hint in an error message.

The union catalog changes no output today. The BGP queries that read origin or the RIB table already fail earlier, on ClickHouse functions DataFusion does not support (arrayFilter, arrayJoin, isIPAddressInRange, toIntervalMinute) or on parse errors. For bgp_analytics in variant_coverage, 5 queries lower and 10 fail, both before and after.

Verification

  • Unit and end-to-end tests: not run locally. The commit was made with --no-verify, so the workspace test suite has not run on this branch. CI runs it.
  • Other checks: cargo check -p asap-executor --lib --tests and cargo clippy -p asap-devtools --all-targets report no warnings, and the before/after tool comparison is above.

No new tests.

Snapshot changes

None.

Architectural decisions

Limitations and follow-up

Human review — do not complete with an agent

  • The MVP boundary is correct.
  • New conceptual layers or public interfaces are necessary.
  • The before/after description matches the intended product behavior.
  • Human reviewer:
  • Decision and rationale:

🤖 Generated with Claude Code

@milindsrivastava1997
milindsrivastava1997 force-pushed the 1046-b-row-reference-oracle-corpus-helpers branch 2 times, most recently from 83f84ae to 1df2a52 Compare October 30, 2026 01:33
…us helpers (#1046)

- executor: remove the row-at-a-time reference operators, their test hook
  in Operator::start, temporal::reduce, and the test-only row helpers
  only they used (collect_rows, row_bytes, key_bytes, compare_rows,
  group_key).
- devtools: one corpora module holds the corpus splitting, the DQC,
  NetFlow and BGP catalogs, and parse_sample_interval. bgp_catalog is the
  union of the four copies, so every BGP corpus query finds its tables
  and columns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milindsrivastava1997
milindsrivastava1997 force-pushed the 1046-b-row-reference-oracle-corpus-helpers branch from 1df2a52 to a475f13 Compare October 30, 2026 01:34
@milindsrivastava1997
milindsrivastava1997 merged commit b48cb26 into main Oct 30, 2026
4 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the 1046-b-row-reference-oracle-corpus-helpers branch October 30, 2026 01:39
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.

1 participant