Commit c9a7beb
authored
SEA metadata: throw for invalid null/empty params (Thrift parity) (#1390)
## Summary
- Change key-based SEA metadata operations (`getPrimaryKeys`,
`getImportedKeys`, `getExportedKeys`, `getCrossReference`) to **throw
`SQLException`** instead of returning empty `ResultSet`s for invalid
parameter combinations
- Matches Thrift server behavior: null/empty table → throw, null schema
with explicit catalog → throw, all-empty strings in cross-reference →
throw
- Builds on #1370 which added null catalog/schema resolution for valid
cases
## What changed
- **`DatabricksMetadataQueryClient.resolveKeyBasedParams()`**: Now
throws `DatabricksSQLException` for invalid combos instead of returning
`null`
- **`DatabricksMetadataQueryClient.listExportedKeys()`**: Added
null/empty table validation
- **`DatabricksDatabaseMetaData.getCrossReference()`**: Added empty
string validation for both parent and foreign sides
- **`DatabricksMetadataQueryClientTest`**: Updated tests to expect
exceptions instead of empty results
- **`MetadataNullResolutionTests`**: Updated integration tests to verify
exception-throwing behavior
## Thrift behavior reference
| Scenario | Thrift behavior | SEA behavior (after this PR) |
|---|---|---|
| `getPrimaryKeys(null, null, table)` | Resolves to current
catalog/schema | Same (from #1370) |
| `getPrimaryKeys(catalog, null, table)` | **Throws** | **Throws** |
| `getPrimaryKeys(catalog, schema, null)` | **Throws** | **Throws** |
| `getCrossReference(all empty strings)` | **Throws** | **Throws** |
## Test plan
- [x] Unit tests: `DatabricksMetadataQueryClientTest` — 57 tests pass
- [ ] Integration tests: `MetadataNullResolutionTests` (requires
WireMock stub re-recording)
- [ ] CI pipeline
NO_CHANGELOG=true
This pull request was AI-assisted by Isaac.
---------
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent cbf02a8 commit c9a7beb
File tree
16 files changed
+197
-524
lines changed- src
- main/java/com/databricks/jdbc
- api/impl
- dbclient/impl/sqlexec
- test
- java/com/databricks/jdbc
- dbclient/impl/sqlexec
- integration/fakeservice/tests
- resources/sqlexecapi/metadatanullresolutiontests
- testgetcrossreference_nullparenttablereturnsempty/mappings
- testgetimportedkeys_nulltablereturnsempty/mappings
- testgetprimarykeys_explicitcatalognullschemareturnsempty/mappings
- testgetprimarykeys_nulltablereturnsempty/mappings
16 files changed
+197
-524
lines changedLines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1132 | 1132 | | |
1133 | 1133 | | |
1134 | 1134 | | |
1135 | | - | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
1136 | 1138 | | |
1137 | | - | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
1138 | 1147 | | |
1139 | 1148 | | |
1140 | 1149 | | |
| |||
Lines changed: 41 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
324 | 326 | | |
325 | 327 | | |
326 | 328 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | 329 | | |
341 | 330 | | |
342 | 331 | | |
| |||
373 | 362 | | |
374 | 363 | | |
375 | 364 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | 365 | | |
390 | 366 | | |
391 | 367 | | |
| |||
414 | 390 | | |
415 | 391 | | |
416 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
417 | 399 | | |
418 | 400 | | |
419 | 401 | | |
| |||
438 | 420 | | |
439 | 421 | | |
440 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
441 | 429 | | |
442 | 430 | | |
443 | 431 | | |
| |||
446 | 434 | | |
447 | 435 | | |
448 | 436 | | |
449 | | - | |
| 437 | + | |
450 | 438 | | |
451 | 439 | | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 440 | + | |
462 | 441 | | |
463 | 442 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | 443 | | |
473 | 444 | | |
474 | 445 | | |
| |||
542 | 513 | | |
543 | 514 | | |
544 | 515 | | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
549 | 523 | | |
550 | 524 | | |
551 | 525 | | |
552 | | - | |
553 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
554 | 531 | | |
555 | 532 | | |
556 | 533 | | |
| |||
560 | 537 | | |
561 | 538 | | |
562 | 539 | | |
563 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
564 | 545 | | |
565 | 546 | | |
| 547 | + | |
566 | 548 | | |
567 | | - | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
568 | 556 | | |
569 | 557 | | |
570 | 558 | | |
| |||
Lines changed: 63 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
759 | 759 | | |
760 | 760 | | |
761 | 761 | | |
762 | | - | |
763 | | - | |
764 | | - | |
| 762 | + | |
| 763 | + | |
765 | 764 | | |
766 | 765 | | |
767 | 766 | | |
| |||
770 | 769 | | |
771 | 770 | | |
772 | 771 | | |
773 | | - | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
774 | 788 | | |
775 | 789 | | |
776 | 790 | | |
| |||
943 | 957 | | |
944 | 958 | | |
945 | 959 | | |
946 | | - | |
| 960 | + | |
947 | 961 | | |
948 | 962 | | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
960 | 972 | | |
961 | 973 | | |
962 | 974 | | |
963 | | - | |
| 975 | + | |
964 | 976 | | |
965 | 977 | | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
980 | 1012 | | |
981 | 1013 | | |
982 | 1014 | | |
| |||
0 commit comments