Skip to content

[POC] Add Sqlstorm queries to velox-testing - #437

Draft
GregoryKimball wants to merge 8 commits into
rapidsai:mainfrom
GregoryKimball:sqlstorm-sweep-poc
Draft

GregoryKimball wants to merge 8 commits into
rapidsai:mainfrom
GregoryKimball:sqlstorm-sweep-poc

Conversation

@GregoryKimball

@GregoryKimball GregoryKimball commented Oct 26, 2026 •

Copy link
Copy Markdown

Adds a sweep that runs the SQLStorm v1.0 StackOverflow queries (18,251 LLM-generated PostgreSQL queries, 1GB dba.stackexchange dataset) against four Presto configurations and reports how many queries complete within a per-query time limit:

  • Presto Java
  • Presto native CPU
  • Presto native GPU with CPU fallback
  • Presto native GPU with CPU fallback disabled (cudf.allow_cpu_fallback=false)
    The no-fallback configuration is a direct measure of GPU operator and expression coverage:
    any operator cuDF cannot run fails the query.

Sqlstorm module components

presto/sqlstorm/

  • download_data.sh, sqlstorm/prepare_data.py: fetch the SQLStorm repo and the 1GB CSV dump,
    convert to Snappy Parquet with lowercase columns, and validate each table's row count against an
    independent CSV parse.
  • sqlstorm/create_tables.py, sqlstorm/schema.py: register the Hive tables.
  • sqlstorm/convert.py: PostgreSQL → Presto translation with sqlglot plus semantics-preserving
    rewrites for constructs sqlglot leaves in a form Presto rejects (unnest forms, = ANY(array),
    subqueries in join conditions, FILTER clauses, COUNT(t.*), GROUP BY output aliases, timestamp
    casts, ...). Rewrites that would need an approximation (e.g. AGE()) are reported as not converted.
    A query counts as converted if it passes EXPLAIN on Presto Java.
  • sqlstorm/sweep.py, sqlstorm/summarize.py: run queries per engine, record status / Presto error
    name / message / elapsed time per query in run_<engine>.csv, and write summary.md. Runs are
    resumable.
  • run_sqlstorm_sweep.sh: end-to-end orchestration (start cluster, register tables, EXPLAIN on Java,
    run each engine, stop cluster). GPU engines run one query at a time; a query that kills the GPU
    worker is recorded as crash and only the worker container is restarted (restart_worker.sh).
    Infrastructure changes outside presto/sqlstorm/

Additional changes for public images

  • --use-public-images for the Presto start scripts: pull prestodb/presto, prestodb/presto-native
    and the GPU nightly images and tag them as the local service images instead of building.
    Public images get their own tag so they never shadow locally built ones.
  • PRESTO_IMAGE_TAG lets the sweep run locally built images.
  • GPU compose template clears the public image's ENTRYPOINT, which ignores the generated config.

Additional changes for GH200

  • Worker launch skips NUMA pinning when numactl is missing from the image.
  • Config generation disables the mmap allocator on non-4KB page kernels (e.g. 64KB aarch64), where
    Velox's MmapAllocator cannot start.
  • Raise the open-file limit for native GPU worker containers.

Add --use-public-images to the start scripts, which pulls the public
coordinator and worker images and tags them as the local service images
instead of building. Make the native worker launch work with those images:
clear the GPU image ENTRYPOINT, mount the profiling wrapper, and skip NUMA
pinning when numactl is not installed. Disable the mmap allocator on hosts
whose page size is not 4KB.
Convert the SQLStorm v1.0 StackOverflow queries from PostgreSQL to Presto
with sqlglot plus semantics-preserving rewrites, check conversion with
EXPLAIN on Presto Java, and run them on Java, native CPU, and native GPU
with and without CPU fallback. Includes data download, CSV to Parquet
conversion, table registration, a resumable per-query runner with GPU
worker crash recovery, and a summary of per-engine pass rates.
…, GROUP BY output aliases, more timestamp casts
…est conditions via FILTER, window FILTER, COUNT(t.*), '{}' arrays
The worker opens ~760 file descriptors at idle on a 72-core host and exceeds
Docker's default soft limit of 1024 under load, aborting with 'Too many open
files'.
Disabling cudf.ast_expression_enabled avoided worker crashes on aarch64
images without the stack trace fix, but cuDF then cannot evaluate most
filters and projections, so no query runs with CPU fallback disabled.
Keep the workaround available through GPU_EXTRA_WORKER_CONFIG.
@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@GregoryKimball

Copy link
Copy Markdown
Author

meta-codesync Bot pushed a commit to facebookincubator/velox that referenced this pull request Nov 9, 2026
## Summary

Part of rapidsai/velox-testing#437 (SQLStorm GPU coverage), adapted from GregoryKimball/velox@400a0b59.

The cuDF AST has no 32-bit cast. `cast(x AS INTEGER)` was lowered to `CAST_TO_INT64`, so comparisons and arithmetic with INTEGER operands failed with "An AST expression was provided non-matching operand types". Casts to INTEGER are now evaluated by `CastFunction`. Tests compare GPU results against the CPU with INTEGER-typed literals.

- `isAstExprSupported` and `pushExprToTree` lower only casts to BIGINT to `CAST_TO_INT64`. A cast to INTEGER now runs as a precomputed function instead of a fused AST node.

Differential Revision: D130722444

Pull Request resolved: #20194
meta-codesync Bot pushed a commit to facebookincubator/velox that referenced this pull request Nov 13, 2026
## Summary

Part of rapidsai/velox-testing#437. Adapted from the FILTER-mask support in GregoryKimball/velox@f0336a09.

Enable GPU execution of grouped `array_agg(x) FILTER (WHERE m)`, preserving the configured null-handling semantics. When null values are retained, wrap the values in a one-field struct whose validity is the filter mask, so collecting the valid rows drops only the masked ones. When null values are excluded, combine the filter mask with input validity without copying the input values. Groups with no retained elements return NULL, including in partial output. 

- Support is limited to grouped aggregation; global filtered `array_agg` continues to run on the CPU.

Differential Revision: D131841046

Pull Request resolved: #20280
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