Extend grammar: joins, GROUP BY, ORDER BY/LIMIT, set ops, WMR, windows#7
Merged
Merged
Conversation
Fix two long-standing generation bugs: - table_ref::factory was missing braces around the subquery branch, so joined_table was unreachable and no JOIN was ever generated - case_expr::out printed the true branch twice, so CASE expressions always had identical branches New grammar coverage: - inner/left/right/full outer joins, nested operands parenthesized - GROUP BY (by ordinal) with appended aggregates and HAVING - ORDER BY (asc/desc, nulls first/last), LIMIT/OFFSET - UNION/INTERSECT/EXCEPT [ALL] with type-templated operands - WITH MUTUALLY RECURSIVE with RETURN AT RECURSION LIMIT - table functions in FROM (unnest, generate_series, jsonb_each, jsonb_array_elements), optionally WITH ORDINALITY - ranking (row_number/rank/dense_rank) and value (lag/lead/ first_value/last_value) window functions, plus window frames - IS DISTINCT FROM predicates - interesting string constants (unicode, LIKE metacharacters, quoting hazards) instead of only '0'/'1'/'2'/'10' Noise reduction so the new constructs don't drown CI in known errors: - classify map_agg as an aggregate - keep pseudo-typed aggregates out of select lists and HAVING - untyped literals for anynonarray/anyelement instead of casts that always fail - retry CASE/templated select list items until types match exactly - drop select_for_update, the Materialize parser rejects FOR <lockmode> Also report impedance statistics in the --log-json output.
def-
added a commit
to MaterializeInc/materialize
that referenced
this pull request
Jul 13, 2026
Propagate SQLsmith thread failures (OOM, bad return codes) instead of silently swallowing them, fix the broken --exclude-catalog flag, and lock the shared result aggregate. Extend coverage: seed data with NULLs, edge values, an empty and a 10k row table, indexes, and list/map/array/range columns. Run two instances per server, every fourth one as an unprivileged role with RBAC checks enabled. Print SQLsmith's impedance stats so blacklisted grammar productions become visible. Suppress the type-unification error family that the extended SQLsmith grammar (joins, GROUP BY, set ops, WITH MUTUALLY RECURSIVE, window functions) triggers. Using MaterializeInc/sqlsmith#7 Test runs: https://buildkite.com/materialize/release-qualification/builds/1310 & https://buildkite.com/materialize/nightly/builds/17150 (both green) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Fix two long-standing generation bugs:
New grammar coverage:
Noise reduction so the new constructs don't drown CI in known errors:
Also report impedance statistics in the --log-json output.