Commit accec17
committed
fix(jdbc-v2): Correctly parse mixed-order CTEs in SqlParser
The grammar for CTEs was too restrictive. It required a specific order
for different CTE syntax styles.
The grammar expected all CTEs to be defined before all CSEs (Common
Scalar Expression).
This commit refactors the `ctes` grammar rule to be more flexible.
It introduces a new, more generic `cte` rule that can represent either CTE style.
The main `ctes` rule is now defined as a list of these generic `cte` elements,
allowing them to appear in any order.1 parent 1e525e7 commit accec17
File tree
2 files changed
+46
-2
lines changed- jdbc-v2/src
- main/antlr4/com/clickhouse/jdbc/internal
- test/java/com/clickhouse/jdbc/internal
2 files changed
+46
-2
lines changedLines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
255 | 275 | | |
256 | 276 | | |
257 | 277 | | |
| |||
329 | 349 | | |
330 | 350 | | |
331 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
332 | 371 | | |
333 | 372 | | |
334 | 373 | | |
| |||
412 | 451 | | |
413 | 452 | | |
414 | 453 | | |
415 | | - | |
| 454 | + | |
0 commit comments