Commit 275d301
Wojciech Padło
Snowflake: parse the EXTERNAL TABLE statement family
Snowflake's `CREATE EXTERNAL TABLE` grammar did not parse: the fork's
`parse_create_external_table` is the Hive-shaped one and the Snowflake
dialect never intercepted `CREATE EXTERNAL TABLE`, so realistic DDL died
in the parser. This teaches the Snowflake dialect the whole external-table
statement family, while leaving the Hive path (which other dialects — and
Snowflake itself, for the `STORED AS … LOCATION '<path>'` form — rely on)
untouched via a tail-shape fallback.
Added under the Snowflake dialect:
* `CREATE [OR REPLACE] EXTERNAL TABLE [IF NOT EXISTS]` with virtual column
definitions (`<col> <type> AS <expr>`, parenthesised or bare), `LOCATION`,
`FILE_FORMAT` (named and inline), `PATTERN`, `REFRESH_ON_CREATE`,
`AUTO_REFRESH`, `PARTITION BY`, `PARTITION_TYPE`, `TABLE_FORMAT`,
`AWS_SNS_TOPIC`, `COPY GRANTS`, tags, row-access policy and `COMMENT`.
* `DROP EXTERNAL TABLE` and `DESC[RIBE] EXTERNAL TABLE` (new
`ObjectType::ExternalTable` / `DescribeObjectType::ExternalTable`).
* `ALTER EXTERNAL TABLE … ADD FILES / REMOVE FILES / SET AUTO_REFRESH /
ADD PARTITION / DROP PARTITION`, alongside the existing `REFRESH`.
New `CreateTable` fields (`pattern`, `refresh_on_create`, `partition_type`,
`table_format`, `aws_sns_topic`) and `AlterTableOperation` variants carry the
Snowflake-only clauses; `Display` round-trips every member back to the same
AST. The `ADD PARTITION` column/value pairs use a dedicated
`ExternalTablePartitionColumn` struct so the `visitor` derive is satisfied.
Deferred/rejected members (`TABLE_FORMAT = DELTA`,
`PARTITION_TYPE = USER_SPECIFIED`, `ADD`/`DROP PARTITION`) parse so they can be
rejected downstream rather than aborting a batch in the parser.
Also brings the branch to a green CI baseline: fills in several stale full
`CreateTable` struct literals in the duckdb/mssql/postgres tests, applies
`cargo fmt`, clears `clippy -D warnings`, and fixes two rustdoc errors.1 parent 94d37ca commit 275d301
15 files changed
Lines changed: 714 additions & 108 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
124 | 142 | | |
125 | 143 | | |
126 | 144 | | |
| |||
498 | 516 | | |
499 | 517 | | |
500 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
501 | 557 | | |
502 | 558 | | |
503 | 559 | | |
| |||
1068 | 1124 | | |
1069 | 1125 | | |
1070 | 1126 | | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
1071 | 1169 | | |
1072 | 1170 | | |
1073 | 1171 | | |
| |||
2477 | 2575 | | |
2478 | 2576 | | |
2479 | 2577 | | |
2480 | | - | |
| 2578 | + | |
2481 | 2579 | | |
2482 | 2580 | | |
2483 | 2581 | | |
| |||
3324 | 3422 | | |
3325 | 3423 | | |
3326 | 3424 | | |
3327 | | - | |
| 3425 | + | |
3328 | 3426 | | |
3329 | 3427 | | |
3330 | 3428 | | |
| |||
3349 | 3447 | | |
3350 | 3448 | | |
3351 | 3449 | | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
| 3453 | + | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
| 3459 | + | |
| 3460 | + | |
| 3461 | + | |
| 3462 | + | |
| 3463 | + | |
| 3464 | + | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
| 3471 | + | |
| 3472 | + | |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
| 3477 | + | |
3352 | 3478 | | |
3353 | 3479 | | |
3354 | 3480 | | |
| |||
3510 | 3636 | | |
3511 | 3637 | | |
3512 | 3638 | | |
3513 | | - | |
| 3639 | + | |
3514 | 3640 | | |
3515 | 3641 | | |
3516 | 3642 | | |
3517 | 3643 | | |
3518 | 3644 | | |
3519 | 3645 | | |
3520 | 3646 | | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
| 3655 | + | |
| 3656 | + | |
| 3657 | + | |
| 3658 | + | |
| 3659 | + | |
| 3660 | + | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
| 3665 | + | |
| 3666 | + | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
3521 | 3674 | | |
3522 | 3675 | | |
3523 | 3676 | | |
| |||
3601 | 3754 | | |
3602 | 3755 | | |
3603 | 3756 | | |
3604 | | - | |
3605 | | - | |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
| 3760 | + | |
3606 | 3761 | | |
3607 | 3762 | | |
3608 | 3763 | | |
| |||
5034 | 5189 | | |
5035 | 5190 | | |
5036 | 5191 | | |
5037 | | - | |
| 5192 | + | |
5038 | 5193 | | |
5039 | 5194 | | |
5040 | 5195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
199 | 209 | | |
200 | 210 | | |
201 | 211 | | |
| |||
267 | 277 | | |
268 | 278 | | |
269 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
270 | 285 | | |
271 | 286 | | |
272 | 287 | | |
| |||
595 | 610 | | |
596 | 611 | | |
597 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
598 | 638 | | |
599 | 639 | | |
600 | 640 | | |
| |||
663 | 703 | | |
664 | 704 | | |
665 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
666 | 711 | | |
667 | 712 | | |
668 | 713 | | |
| |||
750 | 795 | | |
751 | 796 | | |
752 | 797 | | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
753 | 803 | | |
754 | 804 | | |
755 | 805 | | |
| |||
0 commit comments