Repository navigation
Commit eba5002
Support DuckDB's
* Support DuckDB's `lambda x, y : expr` syntax
DuckDB's recommended lambda syntax, `lambda x, y : expr`, had no rule: `lambda x : x + 1`
only parsed by accident, as a column named `lambda` followed by a JSON path, and a
condition body (`lambda x : x > 0`, `lambda x : x IS NOT NULL`) or several parameters
(`lambda acc, x : acc + x`) were rejected. These are the common forms in `list_filter`
and `list_reduce`.
`DuckDBLambdaExpression()` parses it into a `LambdaExpression` flagged with
`isLambdaKeyword()`, which deparses it as written. `LAMBDA` is a non-reserved keyword,
so it remains usable as a name.
* Keep `lambda` a plain identifier outside DuckDB lambdas
As a keyword token, LAMBDA stopped parsing where only plain identifiers are
accepted: `CAST(a AS lambda)`, `COLLATE lambda`, `CREATE TABLE t (a lambda)`,
`ALTER TABLE t DROP COLUMN lambda`, `ALTER TABLE t RENAME lambda TO x`.
`isDuckDBLambdaAhead()` recognises `lambda name [, name ...] :` contextually,
as `isKeywordAhead()` does for other words, so no token is needed.
---------
Co-authored-by: Jules Ivanic <jules.ivanic@feedzai.com>lambda x, y : expr syntax (#2782)1 parent d709c4e commit eba5002
3 files changed
Lines changed: 124 additions & 0 deletions
File tree
- src
- main
- java/net/sf/jsqlparser/expression
- jjtree/net/sf/jsqlparser/parser
- test/java/net/sf/jsqlparser/statement/select
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
56 | 67 | | |
57 | 68 | | |
58 | 69 | | |
| |||
76 | 87 | | |
77 | 88 | | |
78 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
79 | 95 | | |
80 | 96 | | |
81 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1584 | 1584 | | |
1585 | 1585 | | |
1586 | 1586 | | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
1587 | 1614 | | |
1588 | 1615 | | |
1589 | 1616 | | |
| |||
11415 | 11442 | | |
11416 | 11443 | | |
11417 | 11444 | | |
| 11445 | + | |
| 11446 | + | |
| 11447 | + | |
11418 | 11448 | | |
11419 | 11449 | | |
11420 | 11450 | | |
| |||
13248 | 13278 | | |
13249 | 13279 | | |
13250 | 13280 | | |
| 13281 | + | |
| 13282 | + | |
| 13283 | + | |
| 13284 | + | |
| 13285 | + | |
| 13286 | + | |
| 13287 | + | |
| 13288 | + | |
| 13289 | + | |
| 13290 | + | |
| 13291 | + | |
| 13292 | + | |
| 13293 | + | |
| 13294 | + | |
| 13295 | + | |
| 13296 | + | |
| 13297 | + | |
| 13298 | + | |
| 13299 | + | |
| 13300 | + | |
| 13301 | + | |
| 13302 | + | |
13251 | 13303 | | |
13252 | 13304 | | |
13253 | 13305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| |||
689 | 693 | | |
690 | 694 | | |
691 | 695 | | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
692 | 748 | | |
0 commit comments