Commit a0657af
committed
fix: support nested parametric data types as CAST target
ClickHouse allows parametric (constructor-style) data types as a CAST
target, including nested ones such as Nullable(Decimal(10, 2)). Parsing
failed because the argument production of ColDataType only accepted
atomic tokens (numbers, string literals, bare identifiers/keywords), so
the inner opening bracket of a nested parametric type was unexpected.
Allow an argument that is itself a parametric data type (a DATA_TYPE or
identifier immediately followed by an argument list) to be parsed as a
nested ColDataType, recursing through the existing production. The
nested type is rendered back via its toString() so the statement
round-trips.
Fixes #2441
Signed-off-by: 付典 <fudianchn@gmail.com>1 parent f0ba123 commit a0657af
2 files changed
Lines changed: 23 additions & 1 deletion
File tree
- src
- main/jjtree/net/sf/jsqlparser/parser
- test/java/net/sf/jsqlparser/statement/select
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10707 | 10707 | | |
10708 | 10708 | | |
10709 | 10709 | | |
| 10710 | + | |
10710 | 10711 | | |
10711 | 10712 | | |
10712 | 10713 | | |
| |||
10755 | 10756 | | |
10756 | 10757 | | |
10757 | 10758 | | |
| 10759 | + | |
| 10760 | + | |
| 10761 | + | |
10758 | 10762 | | |
10759 | 10763 | | |
10760 | 10764 | | |
| |||
10765 | 10769 | | |
10766 | 10770 | | |
10767 | 10771 | | |
| 10772 | + | |
10768 | 10773 | | |
10769 | 10774 | | |
10770 | | - | |
| 10775 | + | |
| 10776 | + | |
| 10777 | + | |
| 10778 | + | |
| 10779 | + | |
| 10780 | + | |
10771 | 10781 | | |
10772 | 10782 | | |
10773 | 10783 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
143 | 155 | | |
0 commit comments