gulliver_fix
Rewrites SQL to prune partitions and cut big-data cost, labels each change as row-equivalent or result-changing, and optionally verifies changes on generated edge-case data in an in-memory DuckDB.
Instructions
Rewrite SQL so it is cheaper on big data (e.g. DATE(ts) = '...' becomes a range on ts so partitions are pruned) and say per change whether the rows stay exactly the same. With a connection it estimates before vs after (no data read). mode='all' adds rewrites that change the result on purpose (LIMIT, approx count, UNION ALL, NOT EXISTS). verify=true tests each change on generated edge-case data in a private in-memory DuckDB (your data is never read for this). Use it after gulliver_lint finds problems; it only returns SQL and never runs it on the connection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Exactly one SQL statement (SELECT/WITH) in the connection's dialect. Several statements are rejected. | |
| mode | No | safe: only rewrites that keep exactly the same rows. all: also result-changing rewrites. | safe |
| seed | No | Random seed for verify. The same seed gives the same cases, so a counterexample can be reproduced. | |
| cases | No | How many edge-case datasets verify generates (default 200). More cases find rarer differences but take longer. | |
| limit | No | Row limit to add in mode 'all' when the result is unbounded. | |
| verify | No | Also test every change on generated edge-case data (NULLs, duplicates, date boundaries, time zones) in a private in-memory DuckDB, and return a small counterexample when rows differ. A test, not a proof: labels never change because of it. | |
| dialect | No | SQL dialect. Omit to use the connection's dialect. | |
| timezone | No | Session time zone for verify, e.g. 'Europe/Amsterdam'. Omit to try several. | |
| connection | No | Connection name as listed by gulliver_status (from gulliver.toml or GULLIVER_DSN). Omit for the default connection. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| next_step | Yes |