Skip to content

Commit 32ffb70

Browse files
authored
Update chumsky (#377)
1 parent 7b834a2 commit 32ffb70

24 files changed

+162
-170
lines changed

Cargo.lock

+15-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ base64 = "0.22.1"
8484
md-5 = "0.10.6"
8585
half = { version = "2.5.0", features = ["serde", "num-traits", "zerocopy"] }
8686
iana-time-zone = "0.1.62"
87-
chumsky = { version = "=1.0.0-alpha.7", default-features = false, features = ["pratt", "label"] }
87+
chumsky = { version = "0.10.0", default-features = false, features = ["pratt"] }
8888
num = "0.4.3"
8989
hf-hub = { version = "0.4.2", default-features = false, features = ["tokio"] }
9090
reqwest = "0.12.15"

crates/sail-spark-connect/tests/gold_data/expression/interval.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -5146,21 +5146,21 @@
51465146
"input": "Interval 'interval 1 daysss 2 hoursss'",
51475147
"exception": "\n[INVALID_TYPED_LITERAL] The value of the typed literal \"INTERVAL\" is invalid: 'interval 1 daysss 2 hoursss'.(line 1, pos 0)\n\n== SQL ==\nInterval 'interval 1 daysss 2 hoursss'\n^^^\n",
51485148
"output": {
5149-
"failure": "invalid argument: found daysss at 11:17 expected '->', '.', '(', '[', '::', 'ESCAPE', 'IS', 'NOT', 'IN', '*', '/', '%', 'DIV', '+', '-', '||', '>>>', '>>', '<<', '&', '^', '|', '!=', '!>', '!<', '==', '=', '>=', '>', '<=>', '<=', '<>', '<', 'BETWEEN', 'LIKE', 'ILIKE', 'RLIKE', 'REGEXP', 'SIMILAR', 'AND', 'OR', 'YEAR', 'YEARS', 'MONTH', 'MONTHS', 'WEEK', 'WEEKS', 'DAY', 'DAYS', 'HOUR', 'HOURS', 'MINUTE', 'MINUTES', 'SECOND', 'SECONDS', 'MILLISECOND', 'MILLISECONDS', 'MICROSECOND', or 'MICROSECONDS'"
5149+
"failure": "invalid argument: found daysss at 11:17 expected 'YEAR', 'YEARS', 'MONTH', 'MONTHS', 'WEEK', 'WEEKS', 'DAY', 'DAYS', 'HOUR', 'HOURS', 'MINUTE', 'MINUTES', 'SECOND', 'SECONDS', 'MILLISECOND', 'MILLISECONDS', 'MICROSECOND', or 'MICROSECONDS'"
51505150
}
51515151
},
51525152
{
51535153
"input": "Interval 'interval 1 yearsss 2 monthsss'",
51545154
"exception": "\n[INVALID_TYPED_LITERAL] The value of the typed literal \"INTERVAL\" is invalid: 'interval 1 yearsss 2 monthsss'.(line 1, pos 0)\n\n== SQL ==\nInterval 'interval 1 yearsss 2 monthsss'\n^^^\n",
51555155
"output": {
5156-
"failure": "invalid argument: found yearsss at 11:18 expected '->', '.', '(', '[', '::', 'ESCAPE', 'IS', 'NOT', 'IN', '*', '/', '%', 'DIV', '+', '-', '||', '>>>', '>>', '<<', '&', '^', '|', '!=', '!>', '!<', '==', '=', '>=', '>', '<=>', '<=', '<>', '<', 'BETWEEN', 'LIKE', 'ILIKE', 'RLIKE', 'REGEXP', 'SIMILAR', 'AND', 'OR', 'YEAR', 'YEARS', 'MONTH', 'MONTHS', 'WEEK', 'WEEKS', 'DAY', 'DAYS', 'HOUR', 'HOURS', 'MINUTE', 'MINUTES', 'SECOND', 'SECONDS', 'MILLISECOND', 'MILLISECONDS', 'MICROSECOND', or 'MICROSECONDS'"
5156+
"failure": "invalid argument: found yearsss at 11:18 expected 'YEAR', 'YEARS', 'MONTH', 'MONTHS', 'WEEK', 'WEEKS', 'DAY', 'DAYS', 'HOUR', 'HOURS', 'MINUTE', 'MINUTES', 'SECOND', 'SECONDS', 'MILLISECOND', 'MILLISECONDS', 'MICROSECOND', or 'MICROSECONDS'"
51575157
}
51585158
},
51595159
{
51605160
"input": "Interval 'interval 3 monthsss 1 hoursss'",
51615161
"exception": "\n[INVALID_TYPED_LITERAL] The value of the typed literal \"INTERVAL\" is invalid: 'interval 3 monthsss 1 hoursss'.(line 1, pos 0)\n\n== SQL ==\nInterval 'interval 3 monthsss 1 hoursss'\n^^^\n",
51625162
"output": {
5163-
"failure": "invalid argument: found monthsss at 11:19 expected '->', '.', '(', '[', '::', 'ESCAPE', 'IS', 'NOT', 'IN', '*', '/', '%', 'DIV', '+', '-', '||', '>>>', '>>', '<<', '&', '^', '|', '!=', '!>', '!<', '==', '=', '>=', '>', '<=>', '<=', '<>', '<', 'BETWEEN', 'LIKE', 'ILIKE', 'RLIKE', 'REGEXP', 'SIMILAR', 'AND', 'OR', 'YEAR', 'YEARS', 'MONTH', 'MONTHS', 'WEEK', 'WEEKS', 'DAY', 'DAYS', 'HOUR', 'HOURS', 'MINUTE', 'MINUTES', 'SECOND', 'SECONDS', 'MILLISECOND', 'MILLISECONDS', 'MICROSECOND', or 'MICROSECONDS'"
5163+
"failure": "invalid argument: found monthsss at 11:19 expected 'YEAR', 'YEARS', 'MONTH', 'MONTHS', 'WEEK', 'WEEKS', 'DAY', 'DAYS', 'HOUR', 'HOURS', 'MINUTE', 'MINUTES', 'SECOND', 'SECONDS', 'MILLISECOND', 'MILLISECONDS', 'MICROSECOND', or 'MICROSECONDS'"
51645164
}
51655165
},
51665166
{
@@ -6039,7 +6039,7 @@
60396039
"input": "interval '10' month to second",
60406040
"exception": "\nIntervals FROM month TO second are not supported.(line 1, pos 9)\n\n== SQL ==\ninterval '10' month to second\n---------^^^\n",
60416041
"output": {
6042-
"failure": "invalid argument: found second at 23:29 expected end of input"
6042+
"failure": "invalid argument: found end of input expected something else"
60436043
}
60446044
},
60456045
{
@@ -7199,7 +7199,7 @@
71997199
"input": "interval 10 nanoseconds",
72007200
"exception": "\nError parsing ' 10 nanoseconds' to interval, invalid unit 'nanoseconds'.(line 1, pos 9)\n\n== SQL ==\ninterval 10 nanoseconds\n---------^^^\n",
72017201
"output": {
7202-
"failure": "invalid argument: found nanoseconds at 12:23 expected end of input"
7202+
"failure": "invalid argument: found end of input expected something else"
72037203
}
72047204
},
72057205
{

crates/sail-spark-connect/tests/gold_data/expression/like.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"input": "a ilike all()",
6262
"exception": "\nExpected something between '(' and ')'..(line 1, pos 2)\n\n== SQL ==\na ilike all()\n--^^^\n",
6363
"output": {
64-
"failure": "invalid argument: found all at 8:11 expected end of input"
64+
"failure": "invalid argument: found end of input expected something else"
6565
}
6666
},
6767
{
@@ -125,7 +125,7 @@
125125
"input": "a ilike any()",
126126
"exception": "\nExpected something between '(' and ')'..(line 1, pos 2)\n\n== SQL ==\na ilike any()\n--^^^\n",
127127
"output": {
128-
"failure": "invalid argument: found any at 8:11 expected end of input"
128+
"failure": "invalid argument: found end of input expected something else"
129129
}
130130
},
131131
{
@@ -189,7 +189,7 @@
189189
"input": "a ilike some()",
190190
"exception": "\nExpected something between '(' and ')'..(line 1, pos 2)\n\n== SQL ==\na ilike some()\n--^^^\n",
191191
"output": {
192-
"failure": "invalid argument: found some at 8:12 expected end of input"
192+
"failure": "invalid argument: found end of input expected something else"
193193
}
194194
},
195195
{
@@ -386,7 +386,7 @@
386386
"input": "a like all()",
387387
"exception": "\nExpected something between '(' and ')'..(line 1, pos 2)\n\n== SQL ==\na like all()\n--^^^\n",
388388
"output": {
389-
"failure": "invalid argument: found all at 7:10 expected end of input"
389+
"failure": "invalid argument: found end of input expected something else"
390390
}
391391
},
392392
{
@@ -450,7 +450,7 @@
450450
"input": "a like any()",
451451
"exception": "\nExpected something between '(' and ')'..(line 1, pos 2)\n\n== SQL ==\na like any()\n--^^^\n",
452452
"output": {
453-
"failure": "invalid argument: found any at 7:10 expected end of input"
453+
"failure": "invalid argument: found end of input expected something else"
454454
}
455455
},
456456
{
@@ -514,7 +514,7 @@
514514
"input": "a like some()",
515515
"exception": "\nExpected something between '(' and ')'..(line 1, pos 2)\n\n== SQL ==\na like some()\n--^^^\n",
516516
"output": {
517-
"failure": "invalid argument: found some at 7:11 expected end of input"
517+
"failure": "invalid argument: found end of input expected something else"
518518
}
519519
},
520520
{

crates/sail-spark-connect/tests/gold_data/expression/misc.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@
778778
"input": "1 - f('o', o(bar)) hello * world",
779779
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near '*'.(line 1, pos 25)\n\n== SQL ==\n1 - f('o', o(bar)) hello * world\n-------------------------^^^\n",
780780
"output": {
781-
"failure": "invalid argument: found * at 25:26 expected end of input"
781+
"failure": "invalid argument: found end of input expected something else"
782782
}
783783
},
784784
{
@@ -824,7 +824,7 @@
824824
"input": "GEO '(10,-6)'",
825825
"exception": "\n[UNSUPPORTED_TYPED_LITERAL] Literals of the type \"GEO\" are not supported. Supported types are \"DATE\", \"TIMESTAMP_NTZ\", \"TIMESTAMP_LTZ\", \"TIMESTAMP\", \"INTERVAL\", \"X\".(line 1, pos 0)\n\n== SQL ==\nGEO '(10,-6)'\n^^^\n",
826826
"output": {
827-
"failure": "invalid argument: found '(10,-6)' at 4:13 expected end of input"
827+
"failure": "invalid argument: found end of input expected something else"
828828
}
829829
},
830830
{
@@ -899,7 +899,7 @@
899899
"input": "`fo`o.`ba`r",
900900
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 1, pos 5)\n\n== SQL ==\n`fo`o.`ba`r\n-----^^^\n",
901901
"output": {
902-
"failure": "invalid argument: found . at 5:6 expected end of input"
902+
"failure": "invalid argument: found end of input expected something else"
903903
}
904904
},
905905
{
@@ -3660,7 +3660,7 @@
36603660
"input": "foo(a x)",
36613661
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near 'x': extra input 'x'.(line 1, pos 6)\n\n== SQL ==\nfoo(a x)\n------^^^\n",
36623662
"output": {
3663-
"failure": "invalid argument: found ( at 3:4 expected end of input"
3663+
"failure": "invalid argument: found x at 6:7 expected ',', or ')'"
36643664
}
36653665
},
36663666
{

crates/sail-spark-connect/tests/gold_data/expression/numeric.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"input": ".e3",
140140
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 1, pos 0)\n\n== SQL ==\n.e3\n^^^\n",
141141
"output": {
142-
"failure": "invalid argument: found . at 0:1 expected expression"
142+
"failure": "invalid argument: found end of input expected something else"
143143
}
144144
},
145145
{

crates/sail-spark-connect/tests/gold_data/expression/string.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"input": "'''",
2929
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near ''': extra input '''.(line 1, pos 2)\n\n== SQL ==\n'''\n--^^^\n",
3030
"output": {
31-
"failure": "invalid argument: found end of input expected '''"
31+
"failure": "invalid argument: found end of input expected something else, any, ''\\'', or '''''"
3232
}
3333
},
3434
{

crates/sail-spark-connect/tests/gold_data/plan/error_misc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"input": "\nFROM test-table\nSELECT a\nSELECT b\n ",
1212
"exception": "\n[INVALID_IDENTIFIER] The identifier test-table is invalid. Please, consider quoting it with back-quotes as `test-table`.(line 2, pos 9)\n\n== SQL ==\n\nFROM test-table\n---------^^^\nSELECT a\nSELECT b\n \n",
1313
"output": {
14-
"failure": "invalid argument: found FROM at 1:5 expected statement, or end of input"
14+
"failure": "invalid argument: found end of input expected something else"
1515
}
1616
},
1717
{

crates/sail-spark-connect/tests/gold_data/plan/error_select.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@
6060
"input": "SELECT cast('a' as Varchar)",
6161
"exception": "\n[DATATYPE_MISSING_SIZE] DataType \"VARCHAR\" requires a length parameter, for example \"VARCHAR\"(10). Please specify the length.(line 1, pos 19)\n\n== SQL ==\nSELECT cast('a' as Varchar)\n-------------------^^^\n",
6262
"output": {
63-
"failure": "invalid argument: found ) at 26:27 expected '('"
63+
"failure": "invalid argument: found 'a' at 12:15 expected identifier"
6464
}
6565
},
6666
{
6767
"input": "SELECT cast(1 as badtype)",
6868
"exception": "\n[UNSUPPORTED_DATATYPE] Unsupported data type \"BADTYPE\".(line 1, pos 17)\n\n== SQL ==\nSELECT cast(1 as badtype)\n-----------------^^^\n",
6969
"output": {
70-
"failure": "invalid argument: found badtype at 17:24 expected data type"
70+
"failure": "invalid argument: found as at 14:16 expected ',', or ')'"
7171
}
7272
}
7373
]

crates/sail-spark-connect/tests/gold_data/plan/plan_group_by.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"input": "SELECT a, b, count(distinct a, distinct b) as c FROM d GROUP BY a, b",
55
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near 'b': extra input 'b'.(line 1, pos 40)\n\n== SQL ==\nSELECT a, b, count(distinct a, distinct b) as c FROM d GROUP BY a, b\n----------------------------------------^^^\n",
66
"output": {
7-
"failure": "invalid argument: found b at 40:41 expected '->', '.', '(', '[', '::', 'ESCAPE', 'IS', 'NOT', 'IN', '*', '/', '%', 'DIV', '+', '-', '||', '>>>', '>>', '<<', '&', '^', '|', '!=', '!>', '!<', '==', '=', '>=', '>', '<=>', '<=', '<>', '<', 'BETWEEN', 'LIKE', 'ILIKE', 'RLIKE', 'REGEXP', 'SIMILAR', 'AND', 'OR', '=>', ',', 'RESPECT', 'IGNORE', or ')'"
7+
"failure": "invalid argument: found a at 28:29 expected ',', or ')'"
88
}
99
},
1010
{
@@ -107,7 +107,7 @@
107107
{
108108
"input": "select a, b, sum(c) as c from d group by a, b grouping sets((a, b), (a), ())",
109109
"output": {
110-
"failure": "invalid argument: found grouping at 46:54 expected '->', '.', '(', '[', '::', 'ESCAPE', 'IS', 'NOT', 'IN', '*', '/', '%', 'DIV', '+', '-', '||', '>>>', '>>', '<<', '&', '^', '|', '!=', '!>', '!<', '==', '=', '>=', '>', '<=>', '<=', '<>', '<', 'BETWEEN', 'LIKE', 'ILIKE', 'RLIKE', 'REGEXP', 'SIMILAR', 'AND', 'OR', ',', 'WITH', 'HAVING', 'INTERSECT', 'UNION', 'EXCEPT', 'MINUS', 'WINDOW', 'ORDER', 'SORT', 'CLUSTER', 'DISTRIBUTE', 'LIMIT', 'OFFSET', ';', or end of input"
110+
"failure": "invalid argument: found grouping at 46:54 expected ',', 'WITH', 'HAVING', 'INTERSECT', 'UNION', 'EXCEPT', 'MINUS', 'WINDOW', 'ORDER', 'SORT', 'CLUSTER', 'DISTRIBUTE', 'LIMIT', 'OFFSET', ';', or end of input"
111111
}
112112
},
113113
{

crates/sail-spark-connect/tests/gold_data/plan/plan_join.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4827,7 +4827,7 @@
48274827
"input": "select * from t1 inner join t2 inner join t3 on col3 = col2 on col3 = col1",
48284828
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near 'on'.(line 1, pos 60)\n\n== SQL ==\nselect * from t1 inner join t2 inner join t3 on col3 = col2 on col3 = col1\n------------------------------------------------------------^^^\n",
48294829
"output": {
4830-
"failure": "invalid argument: found on at 60:62 expected '->', '.', '(', '[', '::', '*', '/', '%', 'DIV', '+', '-', '||', '>>>', '>>', '<<', '&', '^', '|', 'ESCAPE', 'IS', 'NOT', 'IN', '!=', '!>', '!<', '==', '=', '>=', '>', '<=>', '<=', '<>', '<', 'BETWEEN', 'LIKE', 'ILIKE', 'RLIKE', 'REGEXP', 'SIMILAR', 'AND', 'OR', 'NATURAL', 'INNER', 'CROSS', 'OUTER', 'SEMI', 'ANTI', 'LEFT', 'RIGHT', 'FULL', 'JOIN', ',', 'LATERAL', 'WHERE', 'GROUP', 'HAVING', 'INTERSECT', 'UNION', 'EXCEPT', 'MINUS', 'WINDOW', 'ORDER', 'SORT', 'CLUSTER', 'DISTRIBUTE', 'LIMIT', 'OFFSET', ';', or end of input"
4830+
"failure": "invalid argument: found on at 60:62 expected 'NATURAL', 'INNER', 'CROSS', 'OUTER', 'SEMI', 'ANTI', 'LEFT', 'RIGHT', 'FULL', 'JOIN', ',', 'LATERAL', 'WHERE', 'GROUP', 'HAVING', 'INTERSECT', 'UNION', 'EXCEPT', 'MINUS', 'WINDOW', 'ORDER', 'SORT', 'CLUSTER', 'DISTRIBUTE', 'LIMIT', 'OFFSET', ';', or end of input"
48314831
}
48324832
},
48334833
{

crates/sail-spark-connect/tests/gold_data/plan/plan_misc.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -508,70 +508,70 @@
508508
"input": "from (from a union all from b) c select *",
509509
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near 'union'.(line 1, pos 13)\n\n== SQL ==\nfrom (from a union all from b) c select *\n-------------^^^\n",
510510
"output": {
511-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
511+
"failure": "invalid argument: found end of input expected something else"
512512
}
513513
},
514514
{
515515
"input": "from a",
516516
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near end of input.(line 1, pos 6)\n\n== SQL ==\nfrom a\n------^^^\n",
517517
"output": {
518-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
518+
"failure": "invalid argument: found end of input expected something else"
519519
}
520520
},
521521
{
522522
"input": "from a insert into tbl1 select * insert into tbl2 select * where s < 10",
523523
"output": {
524-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
524+
"failure": "invalid argument: found end of input expected something else"
525525
}
526526
},
527527
{
528528
"input": "from a select * from b",
529529
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near 'from'.(line 1, pos 16)\n\n== SQL ==\nfrom a select * from b\n----------------^^^\n",
530530
"output": {
531-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
531+
"failure": "invalid argument: found end of input expected something else"
532532
}
533533
},
534534
{
535535
"input": "from a select * select * from x where a.s < 10",
536536
"exception": "\n[PARSE_SYNTAX_ERROR] Syntax error at or near 'from'.(line 1, pos 25)\n\n== SQL ==\nfrom a select * select * from x where a.s < 10\n-------------------------^^^\n",
537537
"output": {
538-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
538+
"failure": "invalid argument: found end of input expected something else"
539539
}
540540
},
541541
{
542542
"input": "from a select * select * where s < 10",
543543
"output": {
544-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
544+
"failure": "invalid argument: found end of input expected something else"
545545
}
546546
},
547547
{
548548
"input": "from a select b, c",
549549
"output": {
550-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
550+
"failure": "invalid argument: found end of input expected something else"
551551
}
552552
},
553553
{
554554
"input": "from a select distinct b, c",
555555
"output": {
556-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
556+
"failure": "invalid argument: found end of input expected something else"
557557
}
558558
},
559559
{
560560
"input": "from db.a select b, c where d < 1",
561561
"output": {
562-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
562+
"failure": "invalid argument: found end of input expected something else"
563563
}
564564
},
565565
{
566566
"input": "from t insert into s select * limit 1 insert into u select * where x > 5",
567567
"output": {
568-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
568+
"failure": "invalid argument: found end of input expected something else"
569569
}
570570
},
571571
{
572572
"input": "from t1\nlateral view explode(x) expl as x\ninsert into t2\nselect *\nlateral view json_tuple(x, y) jtup q, z\ninsert into t3\nselect *\nwhere s < 10\n ",
573573
"output": {
574-
"failure": "invalid argument: found from at 0:4 expected statement, or end of input"
574+
"failure": "invalid argument: found end of input expected something else"
575575
}
576576
},
577577
{

0 commit comments

Comments
 (0)