Repository navigation
Metadata::list_tables treats empty table_types slice as match-none (should match all, like null) (#187) #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
960a438
Metadata::list_tables treats empty table_types slice as match-none (s…
80e9918
ai: apply changes for #201 (1 review thread)
4a75e71
Merge remote-tracking branch 'origin/main' into ai/issue-187
vikrantpuppala 94590cf
test: fix list_tables signature in empty-types e2e after merge
vikrantpuppala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // Copyright (c) 2026 Databricks, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| //! E2E repro for issue #187: `Metadata::list_tables` must treat an empty | ||
| //! `table_types` slice (`Some(&[])`) the same as `None` — match ALL table | ||
| //! types — per the JDBC/ADBC contract (spec METADATA-035), not "match none". | ||
| //! | ||
| //! Run with: | ||
| //! ```sh | ||
| //! cargo test --test v0_metadata_empty_types_e2e -- --ignored --nocapture | ||
| //! ``` | ||
|
|
||
| mod common; | ||
|
|
||
| use databricks_sql_kernel::{LikePattern, ResultBatch, ResultStream}; | ||
|
|
||
| async fn count_rows(mut stream: ResultStream) -> usize { | ||
| let mut rows = 0; | ||
| while let Some(rb) = stream.next_batch().await.expect("next_batch") { | ||
| let ResultBatch::Arrow(rb) = rb else { | ||
| panic!("expected Arrow batch in v0"); | ||
| }; | ||
| rows += rb.num_rows(); | ||
| } | ||
| rows | ||
| } | ||
|
|
||
| #[tokio::test] | ||
| #[ignore] | ||
| async fn empty_table_types_matches_all_like_none() { | ||
| let session = common::live_session().await; | ||
|
|
||
| // `samples.information_schema` is a UC-managed schema present in every | ||
| // workspace and exposes many objects (a mix of views), so both the | ||
| // `None` and `Some(&[])` calls should return a positive, equal count. | ||
| let catalog = || Some(LikePattern::new("samples").unwrap()); | ||
| let schema = || Some(LikePattern::new("information_schema").unwrap()); | ||
|
|
||
| let none_rows = count_rows( | ||
| session | ||
| .metadata() | ||
| .list_tables(catalog(), schema(), None, None) | ||
| .await | ||
| .expect("list_tables(None)"), | ||
| ) | ||
| .await; | ||
|
|
||
| let empty_rows = count_rows( | ||
| session | ||
| .metadata() | ||
| .list_tables(catalog(), schema(), None, Some(&[])) | ||
| .await | ||
| .expect("list_tables(Some(&[]))"), | ||
| ) | ||
| .await; | ||
|
|
||
| assert!( | ||
| none_rows > 0, | ||
| "precondition: samples.information_schema should expose tables via None filter; got 0" | ||
| ); | ||
| // The bug: with the unfixed kernel, `Some(&[])` drops every row → 0, | ||
| // while `None` returns `none_rows`. This assertion is red pre-fix. | ||
| assert_eq!( | ||
| empty_rows, none_rows, | ||
| "empty table_types slice must match all types (same as None): \ | ||
| None returned {none_rows} rows, Some(&[]) returned {empty_rows}" | ||
| ); | ||
|
|
||
| session.close().await.expect("close"); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.