Commit 45f865d
committed
[SEA-NodeJS] Address code-review findings on params/metadata/getInfo
Code-review-squad #412 review (79/100). Validated each finding against the
kernel source + a live warehouse before fixing:
- F1 (HIGH): getPrimaryKeys turned an omitted catalog into `?? ''`, which the
kernel's `Identifier::new` rejects with an opaque "identifier must not be
empty" — a regression vs Thrift (which forwards undefined). The napi
`getPrimaryKeys(catalog: string, …)` requires a non-empty catalog, so reject
up front with a clear, actionable message and document the divergence. Added
a test (omitted + empty-string catalog) asserting the kernel call is never
reached. (getCrossReference is unaffected — its parent args are nullable and
passed through without `?? ''`.)
- F3 (MED): mutual-exclusivity of ordinal/named params threw HiveDriverError
with a different message than the Thrift path, which throws
ParameterError('Driver does not support both ordinal and named parameters.')
(ParameterError extends Error, not HiveDriverError — so a caller catching it
worked on Thrift and silently failed on SEA). Now throws the identical
ParameterError + message. Test updated.
- F2 (MED): empirically re-verified against the live warehouse over Thrift —
the server returns the exact same three values we synthesize ("Spark SQL" /
"Spark SQL" / "3.1.1") and errors on every other TGetInfoType (probed
CLI_MAX_DRIVER_CONNECTIONS, CLI_DATA_SOURCE_NAME, …). So throwing on an
unsupported type matches Thrift's effective behaviour rather than narrowing
it; softened the "byte-for-byte" assertion into the validated fact in both
the SeaServerInfo and getInfo doc comments.
- F4 (LOW): getInfo's rejection now names the accepted enum identifiers/values
(CLI_SERVER_NAME (13), CLI_DBMS_NAME (17), CLI_DBMS_VER (18)) so an
agent/SDK consumer can self-correct.
- F5 (LOW): metadata + bound-param execute failures now emit a debug-level
breadcrumb (mapped error + session id) before throwing, via a shared
`logAndMapError` helper, matching the rest of the SEA backend's logging.
- F7 (LOW): dropped the vestigial `nativeStatement!` non-null assertion in
executeStatement (typed the local, mirroring runMetadata).
- F8 (test): added coverage for the getPrimaryKeys omitted-catalog path (F1),
the INTERVAL *→INTERVAL collapse, and the DECIMAL precision clamp-to-38.
F6 (kernel diagnostic getters unconsumed) is tracked as a follow-up — wiring
them in must land with the errorDetailsJson size-guard, out of scope here.
Validated live: getPrimaryKeys(with/without catalog), the ParameterError
parity, and the named-identifier getInfo error all behave as asserted.
Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent 9fe5357 commit 45f865d
4 files changed
Lines changed: 104 additions & 21 deletions
File tree
- lib/sea
- tests/unit/sea
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
95 | 104 | | |
96 | 105 | | |
97 | 106 | | |
98 | | - | |
99 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
100 | 111 | | |
101 | 112 | | |
102 | 113 | | |
| |||
123 | 134 | | |
124 | 135 | | |
125 | 136 | | |
126 | | - | |
127 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
131 | | - | |
132 | | - | |
133 | | - | |
| 144 | + | |
134 | 145 | | |
135 | 146 | | |
136 | 147 | | |
| |||
168 | 179 | | |
169 | 180 | | |
170 | 181 | | |
171 | | - | |
| 182 | + | |
172 | 183 | | |
173 | 184 | | |
174 | 185 | | |
175 | 186 | | |
176 | 187 | | |
177 | 188 | | |
178 | | - | |
| 189 | + | |
179 | 190 | | |
180 | | - | |
| 191 | + | |
181 | 192 | | |
182 | 193 | | |
183 | 194 | | |
| |||
244 | 255 | | |
245 | 256 | | |
246 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
247 | 269 | | |
248 | | - | |
| 270 | + | |
249 | 271 | | |
250 | 272 | | |
251 | 273 | | |
| |||
265 | 287 | | |
266 | 288 | | |
267 | 289 | | |
268 | | - | |
| 290 | + | |
269 | 291 | | |
270 | 292 | | |
271 | 293 | | |
272 | | - | |
| 294 | + | |
273 | 295 | | |
274 | 296 | | |
275 | 297 | | |
276 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
277 | 311 | | |
278 | 312 | | |
279 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
434 | 435 | | |
435 | 436 | | |
436 | 437 | | |
437 | | - | |
| 438 | + | |
438 | 439 | | |
439 | 440 | | |
440 | 441 | | |
| |||
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
446 | | - | |
447 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
448 | 451 | | |
449 | 452 | | |
450 | 453 | | |
| |||
521 | 524 | | |
522 | 525 | | |
523 | 526 | | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
524 | 545 | | |
525 | 546 | | |
526 | 547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
42 | 63 | | |
43 | 64 | | |
44 | 65 | | |
| |||
0 commit comments