Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
/deny.toml @databricks/eng-oss-sql-driver
/about.toml @databricks/eng-oss-sql-driver

# Native ADBC driver, including its public Rust and C ABI surfaces.
/adbc/ @databricks/eng-oss-sql-driver

# PyO3 sub-crate manifests — pip / Python dep changes flow through here.
/pyo3/Cargo.toml @databricks/eng-oss-sql-driver
/pyo3/pyproject.toml @databricks/eng-oss-sql-driver
4 changes: 2 additions & 2 deletions .github/workflows/cargo-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ jobs:
fi
# `--registry jfrog` matches the `[registries.jfrog]` block
# that setup-jfrog writes into ~/.cargo/config.toml. The
# workspace's other members (pyo3/) have their own publish
# workflows / are not part of this release; --no-verify
# standalone ADBC crate remains non-publishable in this release;
# pyo3 and napi have their own workspace release paths. `--no-verify`
# skips re-compiling the crate during the package step
# since CI has already done that elsewhere.
cargo publish \
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on:
paths:
- "src/**"
- "tests/**"
- "adbc/**"
- "pyo3/**"
- "Cargo.toml"
- "Cargo.lock"
Expand All @@ -36,6 +37,7 @@ on:
paths:
- "src/**"
- "tests/**"
- "adbc/**"
- "pyo3/**"
- "Cargo.toml"
- "Cargo.lock"
Expand Down Expand Up @@ -89,7 +91,9 @@ jobs:
- name: Run coverage
# E2E tests stay #[ignore]'d; coverage runs the same suite
# as `pr-checks.yml`'s `test` job.
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
run: |
cargo llvm-cov --workspace --lcov --output-path lcov.info
cargo llvm-cov --manifest-path adbc/Cargo.toml --features ffi --lcov --output-path adbc-lcov.info

# Codecov upload.
#
Expand All @@ -105,6 +109,6 @@ jobs:
- name: Upload to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
files: lcov.info
files: lcov.info,adbc-lcov.info
fail_ci_if_error: false
use_oidc: true
10 changes: 8 additions & 2 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ on:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "adbc/Cargo.toml"
Comment thread
rahuls-db marked this conversation as resolved.
Resolved
- "adbc/Cargo.lock"
- "deny.toml"
# napi/ is a standalone workspace with its own lockfile; its
# dependency graph is invisible to a root `cargo deny` run, so
Expand All @@ -42,6 +44,8 @@ on:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "adbc/Cargo.toml"
- "adbc/Cargo.lock"
- "deny.toml"
- "napi/Cargo.toml"
- "napi/Cargo.lock"
Expand Down Expand Up @@ -92,10 +96,12 @@ jobs:
# `licenses` is the load-bearing check; `advisories` flags
# RustSec security advisories; `bans` and `sources` are
# empty-permissive in our deny.toml today but the slots are
# there for future hardening. The root workspace covers the
# kernel + pyo3 (pyo3 is a root workspace member).
# there for future hardening. The root workspace covers the kernel.
run: cargo deny check

- name: Check licenses, advisories, bans, sources (ADBC workspace)
run: cargo deny --manifest-path "$GITHUB_WORKSPACE/adbc/Cargo.toml" --config "$GITHUB_WORKSPACE/deny.toml" check

- name: Check licenses, advisories, bans, sources (napi workspace)
# napi/ is a separate Cargo workspace (its own Cargo.lock) so
# its transitive graph is NOT seen by the root run above. Scan
Expand Down
47 changes: 44 additions & 3 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ jobs:
components: rustfmt

- name: cargo fmt --check
run: cargo +stable fmt --all -- --check
run: |
cargo +stable fmt --all -- --check
cargo +stable fmt --manifest-path adbc/Cargo.toml -- --check

clippy:
name: Clippy
Expand Down Expand Up @@ -159,6 +161,45 @@ jobs:
# link and call the kernel. `cc` is preinstalled on the runner.
run: make c-abi-test

adbc:
name: ADBC native + C ABI
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- uses: ./.github/actions/setup-jfrog
with:
cargo: "true"

- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
toolchain: 1.89.0
components: clippy

- name: Setup sccache
uses: Mozilla-Actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9

- name: Test native Rust and ADBC C ABI surfaces
working-directory: adbc
run: |
cargo clippy --all-targets --features ffi -- -D warnings
cargo test --features ffi

- name: Build and dynamically load the ADBC driver
working-directory: adbc
run: |
cargo build --release --features ffi --lib --example ffi_smoke
./target/release/examples/ffi_smoke "$PWD/target/release/libdatabricks_adbc.so"

- name: Verify package contents
working-directory: adbc
run: cargo package --allow-dirty --list

check-tls-rustls:
name: Build (tls-rustls feature)
runs-on:
Expand Down Expand Up @@ -187,10 +228,10 @@ jobs:
# opts INTO `tls-rustls` instead. Without this job, a feature-
# gated cfg typo or a dep update that breaks rustls compilation
# would only surface when the downstream napi build breaks.
run: cargo check --no-default-features --features tls-rustls
run: cargo check -p databricks-sql-kernel --no-default-features --features tls-rustls

- name: cargo clippy (tls-rustls)
# Keep clippy honest under both backends so warnings caught
# under tls-native don't disappear under tls-rustls and vice
# versa.
run: cargo clippy --no-default-features --features tls-rustls --all-targets -- -D warnings
run: cargo clippy -p databricks-sql-kernel --no-default-features --features tls-rustls --all-targets -- -D warnings
35 changes: 21 additions & 14 deletions .github/workflows/securityScan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ name: Security Scan
#
# Scanner: OSV-Scanner v2.3.8 (purl-based via OSV.dev; federates
# GHSA, NVD, RustSec, PyPA, Go vuln DB). Reads CycloneDX SBOMs
# produced by `cargo cyclonedx` over the kernel's three standalone
# workspaces:
# produced by `cargo cyclonedx` over the repository's four standalone
# workspace views:
#
# 1. Kernel root `Cargo.toml` (members = ["."]) — emits one SBOM
# for `databricks-sql-kernel`.
# 2. pyo3/ standalone workspace — emits one SBOM for
# 1. Kernel root `Cargo.toml` — emits one SBOM for `databricks-sql-kernel`.
# 2. adbc/ standalone workspace — emits one SBOM for `databricks-adbc`.
# 3. pyo3/ standalone workspace — emits one SBOM for
# `databricks-sql-kernel-pyo3` (built with `tls-rustls`).
# 3. napi/ standalone workspace — emits one SBOM for
# 4. napi/ standalone workspace — emits one SBOM for
# `databricks-sql-kernel-napi` (also `tls-rustls`).
#
# The bindings are deliberately NOT members of the kernel's root
Expand Down Expand Up @@ -107,10 +107,11 @@ jobs:
- name: Install cargo-cyclonedx
run: cargo install cargo-cyclonedx --version 0.5.7 --locked

# Two cyclonedx invocations cover all three published artifacts:
# Four cyclonedx invocations cover all four published artifacts:
#
# - From repo root: writes one SBOM (kernel root is now a
# single-member workspace) — databricks-sql-kernel.cdx.json.
# - From repo root: writes databricks-sql-kernel.cdx.json.
#
# - From adbc/: writes databricks-adbc.cdx.json.
#
# - From pyo3/: standalone workspace, writes one SBOM
# (databricks-sql-kernel-pyo3.cdx.json).
Expand All @@ -127,9 +128,9 @@ jobs:
set -euo pipefail
mkdir -p /tmp/sboms

# The kernel root, pyo3, and napi are each their own
# standalone single-member workspaces (see the workspace
# comment in each Cargo.toml — pyo3 and napi need
# The kernel, ADBC, pyo3, and napi standalone workspaces cover all
# Rust artifacts (see the workspace comment in each Cargo.toml —
# pyo3 and napi need
# `tls-rustls` while the kernel default is `tls-native`,
# and Cargo feature unification across a shared workspace
# would trip the mutual-exclusion `compile_error!` in
Expand All @@ -147,6 +148,11 @@ jobs:
cp "$f" "/tmp/sboms/$(basename "$f")"
done

( cd adbc && cargo cyclonedx --format json )
for f in adbc/*.cdx.json; do
cp "$f" "/tmp/sboms/$(basename "$f")"
done

( cd pyo3 && cargo cyclonedx --format json )
for f in pyo3/*.cdx.json; do
cp "$f" "/tmp/sboms/$(basename "$f")"
Expand All @@ -160,8 +166,8 @@ jobs:
echo "SBOMs:"
ls -lh /tmp/sboms/
# Hard-stop if we lost coverage by accident.
test "$(ls /tmp/sboms/*.cdx.json 2>/dev/null | wc -l)" -ge 3 || {
echo "::error::expected >=3 SBOMs (root crate + pyo3 + napi), got $(ls /tmp/sboms/*.cdx.json 2>/dev/null | wc -l)"
test "$(ls /tmp/sboms/*.cdx.json 2>/dev/null | wc -l)" -ge 4 || {
echo "::error::expected >=4 SBOMs (kernel + ADBC + pyo3 + napi), got $(ls /tmp/sboms/*.cdx.json 2>/dev/null | wc -l)"
exit 1
}

Expand Down Expand Up @@ -194,6 +200,7 @@ jobs:
--format=json \
--output-file=/tmp/osv-out.json \
--sbom=/tmp/sboms/databricks-sql-kernel.cdx.json \
--sbom=/tmp/sboms/databricks-adbc.cdx.json \
--sbom=/tmp/sboms/databricks-sql-kernel-pyo3.cdx.json \
--sbom=/tmp/sboms/databricks-sql-kernel-napi.cdx.json || RC=$?
if [[ "$RC" -gt 1 ]]; then
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/trigger-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Modeled on adbc-drivers/databricks's `trigger-integration-tests.yml`
# (the C# ADBC equivalent). Differences:
# - Single language (Rust) — no per-language path-filter fan-out.
# - Source paths are kernel-relative: src/**, napi/**, pyo3/**,
# - Source paths are kernel-relative: src/**, adbc/**, napi/**, pyo3/**,
# Cargo.{toml,lock}, .github/workflows/**.
# - Dispatched event-type is `kernel-pr-test`.
# - Check-run name is "Kernel Integration Tests" — must match the
Expand Down Expand Up @@ -512,10 +512,10 @@ jobs:
fi
# Path set mirrors the in-repo rust-e2e.yml's source filter
# (src/**, tests/**, Cargo.toml, Cargo.lock, workflow files)
# plus napi/ and pyo3/ wrappers. `tests/` is included because a
# plus adbc/, napi/, and pyo3/ wrappers. `tests/` is included because a
# test-only change can still break kernel-protocol invariants
# that integration tests catch.
if echo "$CHANGED" | grep -qE "^(src/|tests/|napi/|pyo3/|Cargo\.toml|Cargo\.lock|\.github/workflows/)"; then
if echo "$CHANGED" | grep -qE "^(src/|tests/|adbc/|napi/|pyo3/|Cargo\.toml|Cargo\.lock|\.github/workflows/)"; then
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "kernel source files changed"
else
Expand Down
5 changes: 5 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ async API (`Session` → `Statement` → `ExecutedStatement` /
surface) intended for direct Rust use, PyO3 / napi-rs wrappers, and a
custom C ABI (skeleton today) for ODBC / Go consumers.

The standalone `adbc/` workspace implements ADBC 1.1 directly against that native
Rust API. Its optional standard ADBC C ABI is an outer compatibility surface;
the ADBC-to-kernel boundary remains native Rust.

The repo was seeded from `adbc-drivers/databricks` (Rust subtree); the
v0 surface lives at the crate root and the legacy ADBC layer has been
removed.
Expand Down Expand Up @@ -76,6 +80,7 @@ Session -> Metadata (flat per-method catalog API)
| `metadata/` | Shared SQL builders + schemas for `Metadata` |
| `ffi/` | Custom C ABI for ODBC / Go (skeleton) |
| `telemetry/` | Metrics collection |
| `adbc/` | Native Rust ADBC driver and optional driver-manager C ABI |

## Error handling

Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,16 @@ crate-type = ["lib", "cdylib", "staticlib"]

# Workspace — the kernel is its own single-member workspace root.
#
# Neither `pyo3/` nor `napi/` is a member: both bindings opt INTO
# `adbc/`, `pyo3/`, and `napi/` are not members. The bindings require their
# own build and lockfile boundaries; pyo3 and napi also opt INTO
# `tls-rustls` (see the `[features]` comment above for why), while
# the kernel itself defaults to `tls-native` for direct-Rust / C-ABI
# consumers. A single-workspace build would unify the kernel's
# feature set to `tls-native ∪ tls-rustls` across all members,
# trip the mutual-exclusion `compile_error!` in `src/lib.rs`, and
# defeat the per-binding TLS choice. Each binding therefore declares
# its own `[workspace]` (see `pyo3/Cargo.toml` and `napi/Cargo.toml`)
# and reaches the kernel via `path = ".."` — same source tree, three
# workspace views (kernel root, pyo3, napi).
# defeat the per-binding TLS choice. Each sub-crate therefore declares
# its own `[workspace]` and reaches the kernel via `path = ".."` — same
# source tree, four independent workspace views.
[workspace]
members = ["."]

Expand Down
30 changes: 25 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.

.PHONY: all build test fmt lint clean check coverage coverage-check c-abi-test
.PHONY: all build test fmt lint clean check coverage coverage-check c-abi-test adbc-ffi-test

all: build

build:
cargo build
cargo build --manifest-path adbc/Cargo.toml

test:
cargo test
cargo test --manifest-path adbc/Cargo.toml --features ffi

fmt:
cargo fmt
cargo fmt --all
cargo fmt --manifest-path adbc/Cargo.toml

fmt-check:
cargo fmt -- --check
cargo fmt --all -- --check
cargo fmt --manifest-path adbc/Cargo.toml -- --check

lint:
cargo clippy -- -D warnings
cargo clippy --all-targets -- -D warnings
cargo clippy --manifest-path adbc/Cargo.toml --all-targets --features ffi -- -D warnings

# Compile the hand-written C smoke tests against the cdylib and run them.
# Proves the C ABI in `src/ffi/` links and behaves from a real C consumer
Expand All @@ -44,10 +49,25 @@ c-abi-test:
LD_LIBRARY_PATH=target/debug DYLD_LIBRARY_PATH=target/debug ./target/c-abi/$$name || exit 1; \
done

check: fmt-check lint test c-abi-test
# Prove that the ADBC crate exports a loadable ADBC 1.1 C driver while its
# internal kernel integration remains native Rust.
adbc-ffi-test:
cargo test --manifest-path adbc/Cargo.toml --features ffi
Comment thread
rahuls-db marked this conversation as resolved.
Resolved
cargo build --manifest-path adbc/Cargo.toml --features ffi --lib --example ffi_smoke
@case "$$(uname -s)" in \
Darwin*) library=libdatabricks_adbc.dylib ;; \
MINGW*|MSYS*|CYGWIN*) library=databricks_adbc.dll ;; \
*) library=libdatabricks_adbc.so ;; \
esac; \
LD_LIBRARY_PATH="$(CURDIR)/adbc/target/debug" \
DYLD_LIBRARY_PATH="$(CURDIR)/adbc/target/debug" \
./adbc/target/debug/examples/ffi_smoke "$(CURDIR)/adbc/target/debug/$$library"

check: fmt-check lint test c-abi-test adbc-ffi-test
Comment thread
rahuls-db marked this conversation as resolved.
Resolved

clean:
cargo clean
cargo clean --manifest-path adbc/Cargo.toml

coverage:
cargo llvm-cov --all-features --ignore-filename-regex "tests/" --html --open
Expand Down
3 changes: 3 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ changes go in their respective binding's NEXT_CHANGELOG.

### Added

- A native Rust ADBC 1.1 driver in `adbc/`, with an optional standard ADBC C
ABI for driver-manager loading from other languages.

### Changed

### Updated
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ surface) for direct Rust use, the PyO3 (Python) and napi-rs (Node.js)
wrappers, and a C ABI for ODBC / Go consumers. See
[`docs/spec-v0.md`](docs/spec-v0.md) for the API spec.

The separate [`adbc/`](adbc/) Cargo workspace implements ADBC 1.1 directly over this
native Rust API. It provides both Rust traits and an optional standard ADBC C
entry point for driver managers and other languages; the kernel boundary does
not use FFI.

## Status

Early. Expect breaking changes.
Expand All @@ -33,8 +38,11 @@ Early. Expect breaking changes.

```bash
cargo build
cargo test
make check # fmt + clippy + tests
cargo test --workspace
make check # workspace fmt + clippy + tests and native ABI smoke tests

# ADBC is a separate Cargo workspace and is validated explicitly by make check.
cargo test --manifest-path adbc/Cargo.toml --features ffi
```

Native consumers that statically link the kernel and publish separate crash
Expand Down
Loading
Loading