Repository navigation
fix(tpchavoc): run the V7 variants on Presto and fix 16_v6 results - #3003
Merged
joeharris76 merged 2 commits intoOct 18, 2026
Merged
Conversation
Presto rejected nine TPC-Havoc variants and 16_v6 returned wrong results on every engine: - 3_v7, 4_v7, 5_v7, 7_v7, 9_v7, 10_v7, 11_v7 reference SELECT aliases in HAVING; inline them for Presto as already done for PostgreSQL. - 2_v7 uses FILTER on a window aggregate; move the condition into the aggregate argument for Presto. - 1_v7 uses DuckDB LIST functions; collect with ARRAY_AGG and aggregate the zipped arrays with UNNEST. REDUCE is limited to 100,000 elements in Presto C++, which Q1 groups exceed. - 16_v6 rewrote NOT IN as a cross join with <>, which keeps rows when more than one supplier has complaints; use NOT IN over the derived table. Fixes BenchBox-dev#3001
3 tasks done
Collaborator
|
Thanks for the PR submission! I will review it and confirm. |
Collaborator
|
Thanks for putting this together and validating all 242 TPC-Havoc queries at SF10 on Presto C++! The root-cause diagnosis on Before we merge, there are a few small adjustments we will apply on the branch so we can take this out of draft and land it:
I'll push a follow-up commit with these updates to your PR branch, mark the PR ready for review, and run CI. |
joeharris76
marked this pull request as ready for review
October 18, 2026 00:06
joeharris76
enabled auto-merge (squash)
October 18, 2026 00:13
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
Fixes #3001. Presto rejected nine TPC-Havoc variants, and
16_v6returned wrong results on every engine.HAVING(3_v7,4_v7,5_v7,7_v7,9_v7,10_v7,11_v7): Presto does notresolve SELECT aliases in
HAVING. These variants now use the existing alias inlining(
_inline_select_aliases, previously PostgreSQL only) when the dialect ispresto.FILTERon a window aggregate (2_v7): Presto supportsFILTERon plain aggregates but not on windowaggregates. For
presto,MIN(x) FILTER (WHERE c) OVER (...)becomesMIN(IF(c, x, NULL)) OVER (...).Plain aggregates keep
FILTER.LISTfunctions (1_v7): forpresto, the CTE collects withARRAY_AGGand the outer queryaggregates the zipped arrays with
CROSS JOIN UNNEST(quantities, prices, discounts, taxes). Presto zips multiplearrays positionally, like
LIST_ZIP. AREDUCE/ZIP_WITHtranslation like the Databricks one does not work onPresto C++, which limits
REDUCEto 100,000 array elements; each Q1 group has millions at SF10.16_v6semantics: the variant replacedNOT INwith a cross join and<>, which keeps rows whenever morethan one supplier has complaints (4 at SF1). It now uses
NOT INover the same derived table.The Presto rewrites are registered as
query_adapter.presto.tpchavoc.*compatibility rules, anddocs/compat/capability-matrix.mdis regenerated.Type of Change
Testing
make pr-preflight: lint and the mapped tests pass.uv run -- python -m pytest tests/unit/tpchavoc tests/unit/sql_compat: the new tests pass. Two tests intests/unit/tpchavocfail identically on unmodifieddevelopin this environment (DataFusion is not installed,and the BigQuery FILTER expectation differs with sqlglot 30.23.0).
tests/unit/tpchavoc/test_presto_compat.py: no SELECT alias left inHAVING/WHERE, noFILTERon windowaggregates,
1_v7usesARRAY_AGGandUNNEST, and every rewritten variant has a registered rule.test_query16_derived_table_variant_excludes_every_complaint_supplier: base Q16 and16_v6on a three-supplierDuckDB fixture with two complaint suppliers. It fails before the fix (
supplier_cnt3 instead of 1).make compat-docs-check,make comment-policy-check, and the pre-commit hooks pass.master(native C++ workers) at SF10, each checked against itsbase query and against DuckDB on the same Parquet data. Before: 232/242 pass. After: 242/242.
1_v7returns the same row values as base Q1.Public Contract Check
docs/reference/public-contracts.md, or this PR does not changepublic, beta-public, deprecated, generated, experimental, or repo-only
contract surfaces.
status, wrapper facades, adapter subclassing hooks, and generated docs for
contract-map impact.
registry metadata, or explicitly marked editorial/non-authoritative.
Documentation
results-explorer/,website/,landing/,docs/blog/,_blog/or_project/design/site-inventory/, or itsdescription says the change must be replayed into
BenchBox-dev/benchbox-siteto reach benchbox.dev (seeCONTRIBUTING.md).Code Quality
Artifact Hygiene
benchmark outputs, or temporary binary artifacts.
justified here with its consumer and size:
Notes
16_v6changes results on every engine. Stored results for that variant were wrong and will differ after thischange.
prestodialect. Trino likely has the same alias and windowFILTERlimitations, but that was not tested here.