Repository navigation
Commit a79b8cf
authored
## What
Fixes the kernel nightly (red on **both** the normal and reyden legs):
the live E2E test `get_tables_empty_table_types_filter_matches_none`
demanded zero rows for an empty `table_types` filter, but the driver
returned all rows.
Realigns `Metadata::list_tables` / `reshape_tables` with the canonical
cross-driver contract from **adbc-drivers/hiveserver2 #83**: an
**explicit empty** `table_types` slice (`Some(&[])`) matches **NONE**
(zero rows), not all. Only `None` means "all types".
## Why this regressed
Two changes landed with opposite readings of the same spec:
| Date | Change | Empty `table_types` |
|------|--------|--------------------|
| 2026-08-06 | driver-test #1121 (per hiveserver2 #83) flipped
METADATA-035 | → match **NONE** |
| 2026-08-10 | kernel #201 (fix for #187) | → match **ALL** |
#201 implemented #187's "empty should match all like null" premise — but
#83 had **already reversed** that premise 4 days earlier (establishing
that databricks-jdbc's `listTables` has always short-circuited an empty
array to "return nothing", making the earlier #72 reading wrong). Driver
and conformance test ended up on opposite sides. Replay masked it
(recording predates the split); only the live nightly caught it.
## The two surfaces (why both files change)
The typed API and the ODBC C-ABI have **different** empty-type
contracts, and they're coupled:
- **Typed Rust API** (`Option<&[&str]>`, also napi/pyo3) follows
JDBC/ADBC: `None` = all, `Some(&[])` = **none**.
- **ODBC C-ABI** (`SQLTables` CSV) follows the ODBC spec: an empty
`TableType` means "type not used to restrict the search" = **all
types**. ODBC has no way to express a non-null empty list (which is why
driver-test's METADATA-035 is `skipped` for ODBC). Source: [Microsoft
ODBC
`SQLTables`](https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqltables-function)
— *"If TableType is not an empty string, it must contain a list of
comma-separated values…"*.
Because the C-ABI previously relied on `Some(&[]) == None == match-all`
(true post-#201), flipping the typed API to match-none would make an
ODBC empty `TableType` return **zero tables** — a regression. So the
C-ABI must collapse an empty CSV back to `None`. **Both changes are
required together**; shipping only the kernel-typed fix would trade the
nightly failure for an ODBC `SQLTables` regression.
## Changes
- **`thrift_shape.rs`:** drop the `Some([]) => reshaped` arm so an empty
slice flows through `filter_tables_by_type` (whose
`types.iter().any(..)` is `false` for every row → a correctly-typed
empty batch). Rewrote inline + doc comments (they cited the reversed #72
reading). Flipped unit test `tables_empty_types_matches_all` →
`tables_empty_types_matches_none` (asserts 0 rows).
- **`c_abi/metadata.rs`:** re-add the empty-CSV → `None` collapse that
**#223** removed, extracted into a testable `parse_table_types_filter`
helper (keeps #223's `split_table_types_csv` split helper). Added unit
test `parse_table_types_filter_collapses_empty_to_none` locking: null
arg AND `""`/`" "`/`",,"` → `None` (match-all); a CSV with real types →
`Some`. The napi/pyo3 typed surfaces intentionally pass `Some(&[])`
through (match-none) — no change there.
## Testing
- `cargo test --lib`: **767 passed, 0 failed** (incl. flipped
`tables_empty_types_matches_none` and new
`parse_table_types_filter_collapses_empty_to_none`).
- `cargo fmt --check` + `cargo clippy --lib`: clean.
- **Live E2E**: `get_tables_empty_table_types_filter_matches_none` (the
nightly-red test) **passes** against a real warehouse via
`DATABRICKS_KERNEL_PATH` → this branch, `--proxy-mode passthrough`.
## Related
- Reverses the driver behavior from #201 and the C-ABI cleanup from #223
— both built on the match-all premise hiveserver2 #83 overturned.
- Supersedes #187 (its "empty == match-all" premise is overturned by
#83); should be reopened/closed-as-superseded.
- Downstream: databricks-odbc's `KERNEL_REPO_TAG` pin picks this up on
the next routine bump; ODBC `SQLTables` behavior is unchanged (empty CSV
still → match-all via the restored collapse).
This pull request and its description were written by Isaac.
Signed-off-by: eric-wang-1990 <e.wang@databricks.com>
1 parent 3e56482 commit a79b8cf
2 files changed
Lines changed: 80 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
193 | 215 | | |
194 | 216 | | |
195 | 217 | | |
| |||
227 | 249 | | |
228 | 250 | | |
229 | 251 | | |
230 | | - | |
| 252 | + | |
231 | 253 | | |
232 | 254 | | |
233 | 255 | | |
| |||
504 | 526 | | |
505 | 527 | | |
506 | 528 | | |
507 | | - | |
508 | | - | |
509 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
510 | 533 | | |
511 | 534 | | |
512 | 535 | | |
| |||
524 | 547 | | |
525 | 548 | | |
526 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
527 | 577 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
547 | | - | |
548 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
| |||
599 | 600 | | |
600 | 601 | | |
601 | 602 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
606 | 611 | | |
607 | 612 | | |
608 | | - | |
609 | 613 | | |
610 | 614 | | |
611 | 615 | | |
| |||
1338 | 1342 | | |
1339 | 1343 | | |
1340 | 1344 | | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1346 | 1350 | | |
1347 | 1351 | | |
1348 | | - | |
| 1352 | + | |
1349 | 1353 | | |
1350 | 1354 | | |
1351 | 1355 | | |
1352 | 1356 | | |
1353 | 1357 | | |
1354 | | - | |
1355 | | - | |
| 1358 | + | |
| 1359 | + | |
1356 | 1360 | | |
1357 | 1361 | | |
1358 | 1362 | | |
| |||
0 commit comments