Skip to content

[PECOBLR-2065] c-abi: add kernel_metadata_list_table_types - #205

Merged
vikrantpuppala merged 1 commit into
mainfrom
feat/c-abi-list-table-types
Jul 31, 2026
Merged

vikrantpuppala merged 1 commit into
mainfrom
feat/c-abi-list-table-types

Conversation

@vikrantpuppala

Copy link
Copy Markdown
Collaborator

Summary

Expose the existing Metadata::table_types() over the C ABI as kernel_metadata_list_table_types, so C / ODBC consumers can enumerate the supported table types (TABLE, VIEW, SYSTEM TABLE, METRIC_VIEW, …).

This backs the ODBC SQLTables(table_type = SQL_ALL_TABLE_TYPES) enumeration sentinel. The ODBC bridge already routes the all-catalogs / all-schemas sentinels to kernel_metadata_list_catalogs / list_schemas, but there was no C ABI call for table types (the Metadata layer had table_types(), it just wasn't wired to the FFI — noted as a follow-up in src/c_abi/metadata.rs).

Details

  • The call is static — no wire request. The type set comes from the session's transport (Transport::list_table_types), same as the Rust/pyo3/napi surfaces.
  • The stream carries a single TABLE_TYPE column (JDBC getTableTypes shape), mirroring the other list_* entry points, which keep their JDBC-canonical column shape and let drivers reshape on top.
  • Declared in the hand-written include/databricks_kernel.h, mirroring kernel_metadata_list_catalogs.

Test plan

  • New wiremock C ABI test (tests/v0_c_abi_metadata_table_types_wiremock.rs): opens a real session over the C ABI, drives the raw kernel_metadata_list_table_types FFI function, imports the exported schema/batches, and asserts the single-TABLE_TYPE-column shape with ≥1 row.
  • cargo fmt, cargo clippy --all-targets -- -D warnings clean.
  • Existing c_abi (20) and metadata (144) lib tests pass.

Downstream

Once merged, the ODBC driver re-pins this kernel commit and wires SQLTables(table_type = "%") to this call, completing the third enumeration sentinel (databricks/databricks-odbc#141). The catalogs/schemas sentinels already landed in databricks/databricks-odbc#157.

This pull request and its description were written by Isaac.

Expose the existing Metadata::table_types() over the C ABI so C / ODBC
consumers can enumerate the supported table types. This backs ODBC
SQLTables(table_type = SQL_ALL_TABLE_TYPES), the third catalog/schema/
table-type enumeration sentinel — the ODBC bridge already routes the
all-catalogs / all-schemas sentinels to list_catalogs / list_schemas but
had no C ABI call for table types.

The call is static (no wire request): the type set comes from the
session's transport (Transport::list_table_types). The stream carries a
single TABLE_TYPE column (JDBC getTableTypes shape), mirroring the other
list_* entry points.

Adds a wiremock C ABI test that opens a session, drives the raw FFI
function, and asserts the single-column shape with at least one row.

Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

@vikrantpuppala
vikrantpuppala enabled auto-merge July 31, 2026 10:05
@vikrantpuppala
vikrantpuppala added this pull request to the merge queue Jul 31, 2026
Merged via the queue into main with commit 33a3005 Jul 31, 2026
18 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 33211ff2 Deployed Jul 31, 2026 by vikrantpuppala via followup #215
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant