Skip to content

Automatic post-benchmark validation#262

Draft
misiugodfrey wants to merge 3 commits intomainfrom
misiug/BenchmarkValidation
Draft

Automatic post-benchmark validation#262
misiugodfrey wants to merge 3 commits intomainfrom
misiug/BenchmarkValidation

Conversation

@misiugodfrey
Copy link
Contributor

Adds post-benchmark correctness validation that compares query results against known-good expected results stored as Parquet files.

What it does:
After all benchmark queries complete, each query's saved Parquet output is compared row-by-row against an expected result file using DuckDB for loading and the existing assert_rows_equal/normalize_rows comparison utilities. Validation output appears after the benchmark summary table.

How expected results are located:
Explicitly via --expected-results-dir (CLI flag on run_benchmark.sh / pytest option)
Auto-derived from the schema's data path by appending _expected (e.g. $PRESTO_DATA_DIR/sf1 -> $PRESTO_DATA_DIR/sf1_expected)
If neither exists, validation is skipped with a message.

Handling LIMIT queries:
Queries with LIMIT require special handling because the result set can be non-deterministic. The validation classifies each query using sqlglot:
No LIMIT: all columns compared
LIMIT with deterministic ORDER BY (raw columns, COUNT, etc.): only ORDER BY columns are compared, since non-ORDER BY columns can differ at the LIMIT boundary due to ties
LIMIT with float aggregate ORDER BY (SUM, AVG): validation skipped entirely, since distributed floating-point aggregation can change the ranking and thus which rows appear in the result set across runs. We should be able to remove this once decimal support is in, but for now it seems to be non-deterministic.

@misiugodfrey misiugodfrey marked this pull request as draft March 10, 2026 08:01
@misiugodfrey
Copy link
Contributor Author

Moved to draft as I need to de-duplicate the validation between integration tests and the benchmark suite.

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