databricks: support Lakehouse//RT, auto-detecting the SEA backend - #9879
Open
dey-abhishek wants to merge 4 commits into
Open
databricks: support Lakehouse//RT, auto-detecting the SEA backend#9879dey-abhishek wants to merge 4 commits into
dey-abhishek wants to merge 4 commits into
Conversation
Lakehouse//RT warehouses only speak the Statement Execution API (SEA) and reject the Thrift protocol, so Rill (pinned to databricks-sql-go v1.10.0) could not connect to them at all. Bump databricks-sql-go v1.10.0 -> v1.15.1 (adds the SEA/kernel backend) and auto-detect RT: on first connect the connector probes once and, if the warehouse rejects Thrift, transparently switches to the SEA backend. The decision is cached and shared by both the OLAP path and the warehouse ingest path (effectiveDSN), so an RT warehouse works with no configuration. DBSQL warehouses accept Thrift and are unchanged. A `use_kernel` connector property (default false) is available as an explicit override. The SEA backend exports Arrow C Data rather than IPC streams, so the bulk ingest path in warehouse.go falls back from GetArrowIPCStreams to GetArrowBatches (re-serialized to a self-contained Arrow IPC stream via the driver's Arrow v12 writer, which the existing v18 ipc.Reader consumes) when the driver returns ErrNotSupportedByKernel. The OLAP path already worked over SEA. information_schema.Lookup previously JOINed information_schema.tables and columns; that join forces a shuffle that RT's Photon rejects (PHOTON_INTERNAL_ERROR, retry unsupported), breaking the schema browser. Split it into two filtered point-lookups (no shuffle); equivalent on DBSQL. Adds unit tests for DSN resolution, the RT-detection predicate, and the useKernel DSN helper, and documents the behavior. Co-authored-by: Isaac <no-reply@databricks.com>
# Conflicts: # go.mod # go.sum
Adds TestOLAP_LakehouseRT, a live integration test that drives the full Rill Databricks OLAP path against a Lakehouse//RT (Reyden) SQL warehouse over the auto-detected SEA backend. The connector config passes only the DSN (no use_kernel), so a passing query proves the Thrift->SEA autodetection end to end. Because Lakehouse//RT speaks only SEA, the test requires the SEA-via-kernel backend and carries //go:build databricks_kernel (CGO), excluding it from the default Thrift-only build and the standard `go test -short ./...` CI job. It is otherwise gated like the existing Databricks/Snowflake live tests: a leading t.Skip disables it by default, testmode.Expensive keeps it out of normal runs, and it needs RILL_RUNTIME_DATABRICKS_RT_TEST_DSN to point at an RT warehouse. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
databricks: support Lakehouse//RT, auto-detecting the SEA backend (backward compatible with DBSQL)
Problem
Lakehouse//RT (real-time) Databricks warehouses only speak the Statement Execution
API (SEA) protocol and reject the Thrift/HiveServer2 protocol that
databricks-sql-gouses by default:
Rill currently pins
databricks-sql-go v1.10.0, which predates the driver's SEA/kernelbackend, so Rill cannot connect to Lakehouse//RT warehouses at all — the connector fails
at open, before any query runs.
What this changes
databricks-sql-gov1.10.0 → v1.15.1. v1.15.0 introduced the opt-inSEA/kernel backend (
useKernel=true/WithUseKernel(true)). The default remainsThrift, so this bump alone changes no behavior.
connector probes once; if the warehouse rejects Thrift (the RT signal), it
transparently switches to the SEA backend. The probe result is cached and shared by
both the OLAP path and the warehouse ingest path (
effectiveDSN). DBSQL warehousesaccept Thrift and are left unchanged. This means a user can add an RT warehouse in
the UI with no special knowledge — no
use_kernel, noUseThriftClient— and itjust works.
use_kernelconnector property (defaultfalse) as an explicit override. ForcesSEA and skips the probe. Rarely needed given auto-detection, but useful to force SEA.
warehouse.goingest fallback. The bulk-ingest path prefersGetArrowIPCStreams(unchanged Thrift path). The SEA backend doesn't implement IPCstreams — it exports Arrow C Data — and returns an error wrapping
dbsqlerr.ErrNotSupportedByKernel. On that sentinel we fall back toGetArrowBatchesand re-serialize each record to a self-contained Arrow IPC stream(via the driver's Arrow v12
ipc.Writer), which the existing v18ipc.Reader→parquet path consumes untouched. This bridges the driver's Arrow v12 ↔ Rill's Arrow
v18 without changing the DBSQL path. Rill's OLAP path (
olap.go,sqlxrows) wasalready SEA-compatible and is unchanged.
information_schema.Lookupde-JOINed. The per-table schema lookup JOINedinformation_schema.tablesandcolumns; that join forces a shuffle that RT's Photonrejects (
PHOTON_INTERNAL_ERROR, retry unsupported), breaking the schema browser.Split into two filtered point-lookups (no shuffle) — verified against a real RT
warehouse (the JOIN fails, both point-lookups succeed); equivalent on DBSQL.
Backward compatibility
databricks_kerneltag) compile unchanged;use_kerneldefaults tofalse, so DBSQL warehouses are byte-for-byte on the same Thrift path.use_kernel: trueis set in a build without the kernel backend linked, the driverfails at connect with a clear error wrapping
ErrKernelNotCompiled(no silent Thriftfallback, no crash).
Build / distribution note (needs a maintainer decision)
The SEA backend links a native library and is gated behind
-tags databricks_kernelwith CGO. Rill already builds with CGO enabled (DuckDB, confluent-kafka), so the only
additional cost is adding the tag and linking the per-platform kernel archive
(
databricks-sql-kernel-bindings, ~60–95 MB/platform). This PR makes RT supportavailable and correct when built with the tag, and a graceful error otherwise. How
(and whether) to enable the tag in shipped release binaries is left as a follow-up for
maintainers.
Testing
runtime/drivers/databricks/dsn_internal_test.go:TestResolveDSN(backend selection — no
useKernelby default, set when opted in, DSN pass-through,?/&joining, no duplicate),TestRTRequiresSEA(only the Thrift-not-supportedmessage triggers the switch — 403/refused/nil don't), and
TestWithUseKernel.use_kernelset: the connector logged the Thrift→SEA switch and both the connectorand a model reconciled; a regular DBSQL warehouse stayed on Thrift and reconciled.
use_kernel: true): connector + aSELECT current_catalog(), now()model reconcile successfully and materialize into DuckDB.
use_kernelunset, Thrift): aSELECT current_catalog(), current_version(), now()model reconciles successfully —current_version()works here but isUNRESOLVED_ROUTINEon RT, confirming theThrift path is unaffected.
Checklist: