Skip to content

Classify GROUP BY ALL, ORDER BY ALL, WITH RECURSIVE and a table SAMPLE - #107

Merged
kvlonge merged 3 commits into
mainfrom
fix/clause-keys
Nov 6, 2026
Merged

kvlonge merged 3 commits into
mainfrom
fix/clause-keys

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

For C's form linking. The clause classifier gave GROUP BY ALL, ORDER BY ALL and WITH RECURSIVE only their plain clause keys, and gave a SAMPLE on a table reference no key at all, because only Select.sample was read. So group-by.all, order-by.all, with.select.syntax and sample could never be measured.

Change (crates/sqlquack-core classification): new keys, each emitted alongside the existing clause key:

  • clause:group_by_all when GroupBy.all == Some(true);
  • clause:order_by_all when OrderBy.all is set, on SELECT and set operations;
  • clause:with_recursive when With.recursive, on SELECT and set operations;
  • clause:sample on a table reference with table_sample.

coverage/translation/form-links.toml links each one to its form. It's a fail-closed file: an unlinked key fails the measure. C adds the refusal links and the join_using correction afterwards.

Evidence

  • A unit test in test_classify covers each key. sqlquack census shows a plain GROUP BY a ORDER BY a still emits only clause:group_by and clause:order_by.
  • verify-recorded (main's cases, at 90f133d with the same converter): 8470 cases: 6780 passed, 994 diverged as expected, 660 refused, 36 typed, 0 pending, 0 unproven, 0 failed; 220 of 220 equivalences and rules verified.
  • Translation measure against main: 0 regressions, 1 other change. sf.query.group-by.all goes from unmeasured to matching (4 recorded statements). The other three forms have no recorded statement on main yet; C's slices bring them. Baseline re-recorded.
  • Conversion and refusal are unchanged: the keys are added to occurrences, and no rule or policy names them.

The clause classifier emitted clause:group_by, clause:order_by and
clause:with for these forms and nothing for a SAMPLE on a table
reference, so form-links could not tell group-by.all, order-by.all,
with.select.syntax and sample apart. They now also emit
clause:group_by_all, clause:order_by_all, clause:with_recursive and
clause:sample, beside the clause keys they already had.
clause:group_by_all -> sf.query.group-by.all, clause:order_by_all ->
sf.query.order-by.all, clause:with_recursive ->
sf.query.with.select.syntax and clause:sample -> sf.query.sample.
On main's recorded statements group-by.all goes unmeasured ->
matching; the other three have no recorded statement yet. 0
regressions; baseline re-recorded.
kvlonge added a commit that referenced this pull request Nov 6, 2026
…n form-links for PR #107

Eleven records carried a reviewed time a day ahead. Each now takes the
UTC time of the commit that added it.
@kvlonge
kvlonge merged commit 22c11ae into main Nov 6, 2026
1 check failed
@kvlonge
kvlonge deleted the fix/clause-keys branch November 9, 2026 21:31
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