Make the batch benchmark queries portable across all three engines - #60
Merged
estebanzimanyi merged 1 commit intoJul 22, 2026
Conversation
queries.sql is the single source run by every batch runner (PostgreSQL, DuckDB, Spark), but seven queries used PostgreSQL-only syntax that Spark and DuckDB cannot parse: the && bounding-box overlap operator (q09, q11-q16) and a ::numeric cast in q09. Replace each && spatial prefilter with the th3index cell prefilter already used by q02 and q04 -- eEq(geoToH3IndexSet(geom, 7), trip_h3) for polygon inputs, COALESCE(eEq(geoToH3Cell(geom, 7), trip_h3), TRUE) for point inputs. Both are sound conservative prefilters supported by every engine, and the exact predicate that follows each is unchanged, so the results are identical. For q09's temporal prefilter, use the equivalent atTime(...) IS NOT NULL guard and drop the PostgreSQL-only ::numeric round, matching the portable form. All 18 @query markers are preserved; only the seven prefilter expressions change.
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.
The batch
queries.sqlis the single source run by all three benchmark runners (PostgreSQL, DuckDB, Spark). Seven queries used PostgreSQL-only syntax that Spark and DuckDB cannot parse, so the "runs unchanged on all three engines" contract did not actually hold for them:&&bounding-box overlap operator in q09 and q11–q16::numericcast in q09Each
&&spatial prefilter is replaced with the th3index cell prefilter already used by q02 and q04:eEq(geoToH3IndexSet(geom, 7), trip_h3)for polygon inputs (q13, q14, q16)COALESCE(eEq(geoToH3Cell(geom, 7), trip_h3), TRUE)for point inputs (q11, q12, q15)Both are sound conservative prefilters that every engine supports, and the exact predicate that follows each is unchanged — so the results are identical, only the prefilter expression differs. For q09 the temporal
&&becomes the equivalentatTime(...) IS NOT NULLguard and the PostgreSQL-only::numericround is dropped, matching the portable form.All 18
@querymarkers are preserved; only the seven prefilter expressions change.