Skip to content

Commit f2f7a23

Browse files
committed
[SEA-NodeJS] Rename SEA → kernel across the driver (useSEA → useKernel)
Re-applied on top of main (which now includes #416's consolidated kernel backend: connection/statement options, TLS & configurable sync/async). The original rename branch was based on the older sea-kernel-rev-pin stack; a literal rebase would have hit modify/delete conflicts on every backend file, so the rename was re-derived against current main. Scope: - Directories: lib/sea→lib/kernel, native/sea→native/kernel, tests/unit/sea→tests/unit/kernel, tests/e2e/sea→tests/e2e/kernel. - Files/classes: Sea*→Kernel* (SeaBackend→KernelBackend, SeaSessionBackend, SeaOperationBackend, SeaNativeLoader, SeaAuth, …). - Public option: useSEA→useKernel (hard rename; no back-compat alias). - COMPLETE this time: the internal helpers the prior pass left sea-named are renamed too — getSeaNative→getKernelNative, buildSea*→buildKernel*, seaCancel/Close/Finished→kernel*, seaServerInfoValue→kernelServerInfoValue, SEA_DBMS_*/SEA_NATIVE_EXPECTED→KERNEL_*. Intentionally preserved: 'SEA' where it denotes the Statement Execution API wire protocol (comments/JSDoc), Python's use_sea reference, and the telemetry backend union member 'sea' (dashboard back-compat). Verified: tsc clean, lint clean, full unit suite 1166 passing, live end-to-end (2 executions via useKernel) green. Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
1 parent 4b9e16e commit f2f7a23

55 files changed

Lines changed: 583 additions & 583 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ Dockerfile* text
3636
# crate; regenerated by `npm run build:native`. Tell git/GitHub they're
3737
# machine-generated so they collapse in diffs and are excluded from
3838
# blame and language stats.
39-
native/sea/index.d.ts linguist-generated=true
40-
native/sea/index.js linguist-generated=true
39+
native/kernel/index.d.ts linguist-generated=true
40+
native/kernel/index.js linguist-generated=true

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ dist
1212
lib/version.ts
1313

1414
# SEA native binding — copied/generated from kernel workspace by `npm run build:native`.
15-
# The committed contract is `native/sea/index.d.ts` (TypeScript declarations) and
16-
# `native/sea/index.js` (the napi-rs platform router — small, stable, and required in
15+
# The committed contract is `native/kernel/index.d.ts` (TypeScript declarations) and
16+
# `native/kernel/index.js` (the napi-rs platform router — small, stable, and required in
1717
# the publish tarball so a missing build step can't ship a tarball that can't load).
1818
# The `.node` binaries are large per-platform artifacts and must NOT be committed;
1919
# in production they arrive via the `@databricks/sql-kernel-<triple>` optional deps.
20-
native/sea/index.node
21-
native/sea/index.*.node
20+
native/kernel/index.node
21+
native/kernel/index.*.node

.npmignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
# selects the per-platform `.node` artifact from `@databricks/sql-kernel-*`
88
# optionalDependencies (populated when the kernel CI publishes them);
99
# the .d.ts is the consumer-facing type contract.
10-
!native/sea/index.js
11-
!native/sea/index.d.ts
10+
!native/kernel/index.js
11+
!native/kernel/index.d.ts
1212

1313
!LICENSE
1414
!NOTICE

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ package-lock.json
1515
# Generated by napi-rs from the kernel's `napi-binding/napi/` crate;
1616
# regenerated by `npm run build:native`. Format follows napi-rs's
1717
# defaults (no semicolons), not this repo's prettier config.
18-
native/sea/index.d.ts
19-
native/sea/index.js
18+
native/kernel/index.d.ts
19+
native/kernel/index.js

lib/DBSQLClient.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { buildUserAgentString } from './utils';
1818
import IBackend from './contracts/IBackend';
1919
import { InternalConnectionOptions } from './contracts/InternalConnectionOptions';
2020
import ThriftBackend from './thrift-backend/ThriftBackend';
21-
import SeaBackend from './sea/SeaBackend';
21+
import KernelBackend from './kernel/KernelBackend';
2222
import PlainHttpAuthentication from './connection/auth/PlainHttpAuthentication';
2323
import DatabricksOAuth, { OAuthFlow } from './connection/auth/DatabricksOAuth';
2424
import {
@@ -627,12 +627,12 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient, I
627627

628628
this.connectionProvider = this.createConnectionProvider(options);
629629

630-
// M0: `useSEA` is consumed via a non-exported internal-options cast so it
630+
// M0: `useKernel` is consumed via a non-exported internal-options cast so it
631631
// doesn't ship in the public `.d.ts`. Mirrors Python's `kwargs.get("use_sea")`
632632
// pattern (see databricks-sql-python/src/databricks/sql/session.py).
633633
const internalOptions = options as ConnectionOptions & InternalConnectionOptions;
634-
const backend = internalOptions.useSEA
635-
? new SeaBackend({ context: this })
634+
const backend = internalOptions.useKernel
635+
? new KernelBackend({ context: this })
636636
: new ThriftBackend({
637637
context: this,
638638
onConnectionEvent: (event, payload) => this.forwardConnectionEvent(event, payload),

lib/contracts/IBackend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import ISessionBackend from './ISessionBackend';
33

44
/**
55
* Top-level backend dispatch handle. One instance per `DBSQLClient`,
6-
* chosen at `connect()` time based on the `useSEA` flag and never
6+
* chosen at `connect()` time based on the `useKernel` flag and never
77
* re-selected per-call.
88
*/
99
export default interface IBackend {
1010
/**
1111
* Establish backend-level state before any session is opened. Implementations
1212
* consume `options` to build backend-specific connection parameters (e.g. the
13-
* SEA backend derives napi-binding `SeaNativeConnectionOptions` from the auth
13+
* SEA backend derives napi-binding `KernelNativeConnectionOptions` from the auth
1414
* + host fields here). Transport-layer connection providers are owned by
1515
* `DBSQLClient` (via `IClientContext`) and exposed to backends through
1616
* constructor injection.

lib/contracts/IDBSQLSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type ExecuteStatementOptions = {
1919
* - **Thrift backend:** no-op. The Thrift path always submits asynchronously
2020
* (`runAsync: true` on the wire) and polls during fetch; this option is not
2121
* read.
22-
* - **Kernel backend (`useSEA`):** selects the kernel execution path —
22+
* - **Kernel backend (`useKernel`):** selects the kernel execution path —
2323
* `false`/unset (default) runs the blocking direct-results path (faster,
2424
* cancellable mid-compute); `true` submits and polls (returns a pending
2525
* handle before completion). Default is sync, matching the python

lib/contracts/InternalConnectionOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* signature (see `databricks-sql-python/src/databricks/sql/session.py`).
88
*
99
* Callers cast `ConnectionOptions` to this type *only* at the read site
10-
* inside the driver; user code that wants to set `useSEA` may still do so
10+
* inside the driver; user code that wants to set `useKernel` may still do so
1111
* via an untyped object literal — the option is not part of the public
1212
* contract and may be removed without notice.
1313
*/
@@ -17,7 +17,7 @@ export interface InternalConnectionOptions {
1717
* backend instead of the default Thrift backend. Defaults to `false`.
1818
* @internal Not stable; M0 stub only.
1919
*/
20-
useSEA?: boolean;
20+
useKernel?: boolean;
2121

2222
/**
2323
* SEA-only: kernel connection-pool size (`ConnectionOptions.max_connections`).
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import { RecordBatchReader, MessageReader, MessageHeader, Schema, Field, DataType, TypeMap } from 'apache-arrow';
1616
import { TTableSchema, TTypeId, TPrimitiveTypeEntry } from '../../thrift/TCLIService_types';
17-
import { rewriteDurationToInt64, DURATION_UNIT_METADATA_KEY } from './SeaArrowIpcDurationFix';
17+
import { rewriteDurationToInt64, DURATION_UNIT_METADATA_KEY } from './KernelArrowIpcDurationFix';
1818
import HiveDriverError from '../errors/HiveDriverError';
1919

2020
/**
@@ -29,7 +29,7 @@ const DATABRICKS_TYPE_NAME = 'databricks.type_name';
2929
*
3030
* Why this exists: `ArrowResultConverter` consumes `ArrowBatch` objects
3131
* that carry an explicit `rowCount`, but the kernel's IPC payload only
32-
* carries per-RecordBatch `length` (no separate total). `SeaResultsProvider`
32+
* carries per-RecordBatch `length` (no separate total). `KernelResultsProvider`
3333
* needs that count to build the `ArrowBatch` it hands to the converter —
3434
* which then re-decodes the same bytes for the actual values.
3535
*
@@ -89,12 +89,12 @@ export function decodeIpcSchema(ipcBytes: Buffer): Schema<TypeMap> {
8989
* Pre-process raw IPC bytes from the kernel so they're consumable by
9090
* `apache-arrow@13`. The current transformation is `Duration → Int64`
9191
* with the original duration unit preserved in field metadata (see
92-
* `SeaArrowIpcDurationFix.ts`). Returned bytes are byte-identical to
92+
* `KernelArrowIpcDurationFix.ts`). Returned bytes are byte-identical to
9393
* the input when no transformation is needed.
9494
*
9595
* Exposed so callers can pre-patch the buffer **once** and pass the
9696
* result through both `decodeIpcBatch` (for row-count extraction in
97-
* `SeaResultsProvider`) and `ArrowResultConverter.fetchNext` (which
97+
* `KernelResultsProvider`) and `ArrowResultConverter.fetchNext` (which
9898
* re-decodes the same bytes via `RecordBatchReader.from`). Without
9999
* this, the converter would re-throw on `Duration` because it never
100100
* sees the patched bytes.
@@ -198,7 +198,7 @@ function arrowTypeToTTypeId(field: Field<DataType>): TTypeId {
198198
if (DataType.isInt(arrowType)) {
199199
// Duration columns are rewritten to Int64 with a
200200
// `databricks.arrow.duration_unit` metadata marker (see
201-
// `SeaArrowIpcDurationFix.ts`). Surface them as INTERVAL_DAY_TIME
201+
// `KernelArrowIpcDurationFix.ts`). Surface them as INTERVAL_DAY_TIME
202202
// so the converter formats them back into the thrift string form.
203203
if (arrowType.bitWidth === 64 && field.metadata.has(DURATION_UNIT_METADATA_KEY)) {
204204
return TTypeId.INTERVAL_DAY_TIME_TYPE;
@@ -246,7 +246,7 @@ function arrowTypeToTTypeId(field: Field<DataType>): TTypeId {
246246

247247
/**
248248
* Synthesize a Thrift `TTableSchema` from an Arrow schema decoded out
249-
* of the kernel's IPC stream. Used by `SeaOperationBackend.getResultMetadata`
249+
* of the kernel's IPC stream. Used by `KernelOperationBackend.getResultMetadata`
250250
* to drive `ArrowResultConverter.convertThriftTypes` (Phase 2) without
251251
* changing that code.
252252
*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*
4646
* Why this lives in its own file: the rewriter is the only place in the
4747
* codebase that needs to construct FlatBuffers by hand using the
48-
* `flatbuffers` library; isolating it keeps `SeaArrowIpc.ts` focused on
48+
* `flatbuffers` library; isolating it keeps `KernelArrowIpc.ts` focused on
4949
* the high-level Arrow-decoded views.
5050
*
5151
* @see lib/result/ArrowResultConverter.ts — the Phase-1 INTERVAL formatter

0 commit comments

Comments
 (0)