Commit a6db91b
fix(sql): disambiguate
DataFusion has long accepted parentheses wrapping the query after
`EXPLAIN` (e.g. `EXPLAIN (SELECT ...)` and
`EXPLAIN (q1 EXCEPT q2) UNION ALL (q3 EXCEPT q4)`). The initial cut of
the Postgres-style option-list parser treated every leading `(` as an
option list, breaking those cases.
Disambiguate by peeking one token past the `(`: if it starts a query
(`SELECT`, `WITH`, `VALUES`, `TABLE`, `INSERT`, `UPDATE`, `DELETE`,
`MERGE`, or another `(`), fall through to the legacy parser.
Adds `explain_paren_grouping_query_is_not_mistaken_for_options` to
cover the regression set that CI surfaced (`references.slt`,
`union.slt`).
Also reformats `docs/source/user-guide/explain-usage.md` to satisfy
`prettier 2.7.1` (column-width alignment only).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>EXPLAIN (...) option list from grouped query1 parent 54231ee commit a6db91b
2 files changed
Lines changed: 61 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
485 | 506 | | |
486 | 507 | | |
487 | 508 | | |
| |||
799 | 820 | | |
800 | 821 | | |
801 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
802 | 829 | | |
803 | | - | |
804 | | - | |
805 | 830 | | |
806 | 831 | | |
| 832 | + | |
807 | 833 | | |
808 | 834 | | |
809 | 835 | | |
| |||
2330 | 2356 | | |
2331 | 2357 | | |
2332 | 2358 | | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
| 2365 | + | |
| 2366 | + | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
2333 | 2383 | | |
2334 | 2384 | | |
2335 | 2385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
263 | 263 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
0 commit comments