Commit 2285cd1
committed
feat(isthmus): make unquoted identifier casing configurable in ConverterProvider
Add constructor-based configuration of unquoted SQL identifier casing to
ConverterProvider, so that isthmus consumers can control how unquoted
identifiers are cased during parsing. The default remains Casing.TO_UPPER
(no behaviour change).
Previously the only way to change this was to subclass ConverterProvider
and override getSqlParserConfig() — as IsthmusEntryPoint already did with
an anonymous class. That workaround is now replaced by a first-class
constructor parameter.
Changes to ConverterProvider:
- unquotedCasing is a new final field, consistent with executionBehavior
- getUnquotedCasing() getter
- getSqlParserConfig() reads unquotedCasing instead of hard-coding TO_UPPER
- new ConverterProvider(Casing) and ConverterProvider(extensions, typeFactory, Casing)
for the common cases; the existing 7-arg constructor gains Casing as an 8th
parameter; all narrower constructors default to Casing.TO_UPPER
Propagation through the pipeline — casing is applied consistently across
both CREATE TABLE parsing and query parsing:
- SubstraitSqlToCalcite: new convertQueries(sql, catalog, ConverterProvider,
operatorTable) overload passes getSqlParserConfig() to the statement parser
- SqlToSubstrait: convert(sql, catalog) uses the ConverterProvider overload;
the legacy convert(sql, catalog, SqlDialect) overload is deprecated and now
delegates to it (the SqlDialect argument is ignored — casing is controlled
by the ConverterProvider)
- SubstraitCreateStatementParser: new processCreateStatements(ConverterProvider, sql)
and processCreateStatementsToCatalog(ConverterProvider, ...) overloads;
SqlParser.Config stays an internal detail
- SqlExpressionToSubstrait: uses processCreateStatements(converterProvider, tableDef)
- IsthmusEntryPoint: uses new ConverterProvider(unquotedCasing);
anonymous ConverterProvider subclass removed
Examples:
- FromSql: replaced the deprecated convert(sql, catalog, SqlDialect) call with
a shared ConverterProvider(Casing.UNCHANGED) used for both schema and query
parsing, preserving the lower-case identifiers as written1 parent a29fbb1 commit 2285cd1
12 files changed
Lines changed: 356 additions & 133 deletions
File tree
- examples/isthmus-api/src/main/java/io/substrait/examples
- isthmus-cli/src/main/java/io/substrait/isthmus/cli
- isthmus/src
- main/java/io/substrait/isthmus
- sql
- test/java/io/substrait/isthmus
Lines changed: 14 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | | - | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | | - | |
| 60 | + | |
| 61 | + | |
54 | 62 | | |
55 | | - | |
56 | | - | |
| 63 | + | |
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
62 | 69 | | |
63 | | - | |
64 | 70 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| |||
Lines changed: 4 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 62 | | |
73 | 63 | | |
74 | 64 | | |
| |||
96 | 86 | | |
97 | 87 | | |
98 | 88 | | |
| 89 | + | |
99 | 90 | | |
100 | 91 | | |
101 | | - | |
| 92 | + | |
102 | 93 | | |
103 | 94 | | |
104 | 95 | | |
105 | | - | |
| 96 | + | |
106 | 97 | | |
107 | 98 | | |
108 | | - | |
| 99 | + | |
109 | 100 | | |
110 | 101 | | |
111 | 102 | | |
| |||
Lines changed: 90 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
| |||
78 | 90 | | |
79 | 91 | | |
80 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
81 | 108 | | |
82 | 109 | | |
83 | 110 | | |
| |||
95 | 122 | | |
96 | 123 | | |
97 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
98 | 140 | | |
99 | 141 | | |
100 | 142 | | |
101 | 143 | | |
102 | 144 | | |
103 | 145 | | |
104 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
105 | 149 | | |
106 | 150 | | |
107 | 151 | | |
| |||
121 | 165 | | |
122 | 166 | | |
123 | 167 | | |
124 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
125 | 177 | | |
126 | 178 | | |
127 | 179 | | |
| |||
143 | 195 | | |
144 | 196 | | |
145 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
146 | 223 | | |
147 | 224 | | |
148 | 225 | | |
149 | 226 | | |
150 | 227 | | |
151 | 228 | | |
152 | 229 | | |
| 230 | + | |
153 | 231 | | |
154 | 232 | | |
155 | 233 | | |
| |||
165 | 243 | | |
166 | 244 | | |
167 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
168 | 255 | | |
169 | 256 | | |
170 | 257 | | |
| |||
173 | 260 | | |
174 | 261 | | |
175 | 262 | | |
176 | | - | |
| 263 | + | |
177 | 264 | | |
178 | 265 | | |
179 | 266 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| |||
Lines changed: 16 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
| |||
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
| 22 | + | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
| |||
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
69 | 79 | | |
| 80 | + | |
70 | 81 | | |
71 | 82 | | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 86 | + | |
89 | 87 | | |
90 | 88 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments