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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Release completed Thrift CloudFetch body-reader listeners so idle connections do not retain downloaded result buffers.
- **Behavior change:** Thrift `getSchema()` and `getResultMetadata().schema` return `{ columns: [] }` for statements without output columns when Arrow metadata has no fields. Check `columns.length` before indexing. `getMetadata()` and responses without Arrow metadata (including `arrowEnabled: false` and older protocols) retain the `Result STRING` placeholder. (#651)
- Fix `fetchAll()` and `fetchChunk()` hanging on column-based results with an empty or missing schema. (#651)
- Kernel backend: support SOCKS proxies through the `proxy` option.
Comment thread
cathleeny marked this conversation as resolved.
Resolved
Comment thread
cathleeny marked this conversation as resolved.
Resolved
Comment thread
cathleeny marked this conversation as resolved.
Resolved

## 3.1.0

Expand Down
4 changes: 2 additions & 2 deletions CONNECTION_PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Per-statement `useCloudFetch` overrides remain unsupported on the kernel backend
| Option | Type | Thrift | Kernel | Default Value | Note |
| --------------------------- | ------------------------ | :----: | :----: | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `socketTimeout` | `number` (ms) | ✅ | ⚠️ | `900000` / `120000` | Kernel forwards only positive values. `0` means no timeout on Thrift but is omitted on Kernel, which then keeps its 120-second default. |
| `proxy` | `ProxyOptions` | ✅ | ⚠️ | — | `{protocol, host, port, auth}`. Kernel supports HTTP/HTTPS proxies only; Thrift also supports the declared SOCKS variants. |
| `proxy` | `ProxyOptions` | ✅ | ⚠️ | — | `{protocol, host, port, auth}`. Kernel maps `socks` to `socks5h` (DNS at the proxy, as on Thrift) and doesn't send a SOCKS4 user ID yet. Without `proxy`, it honors `HTTPS_PROXY`, `ALL_PROXY` and `NO_PROXY` (SOCKS too); Thrift ignores them. |
| `noProxy` (internal) | `string` | ❌ | ⚠️ | — | Runtime-only Kernel bypass list, forwarded as `bypassHosts` only when an explicit `proxy` is also supplied. |
| `customHeaders` | `Record<string, string>` | ✅ | ✅ | — | Sent on workspace, telemetry and feature-flag requests, not OAuth. Workspace calls ignore caller `Authorization`, `User-Agent`, `Content-Type`, `Content-Length`, `Transfer-Encoding`, `Connection`; Kernel also ignores `x-databricks-org-id`. |
| `retryMaxAttempts` | `number` | ✅ | ✅ | `5` | Total attempts, including the initial request. Kernel converts this to its retries-after-first representation internally. |
Expand Down Expand Up @@ -243,7 +243,7 @@ session parameter surface.
## Main backend gaps

Thrift-only capabilities include custom/token-provider authentication, custom
OAuth persistence, SOCKS proxies, authenticated/driver-buffer telemetry knobs,
OAuth persistence, SOCKS4 user IDs, authenticated/driver-buffer telemetry knobs,
query timeout, Direct Results `maxRows`, per-statement CloudFetch/LZ4 hints, and
volume operations.

Expand Down
2 changes: 1 addition & 1 deletion KERNEL_REV
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3b691d2a2c235ef847d61b308c31604979830994
a29235cbea9532efa5572ebff010045583a19cbe
11 changes: 6 additions & 5 deletions lib/kernel/KernelAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export interface KernelHttpOptions {
}

/**
* HTTP(S) proxy forwarded to the napi binding's `ConnectionOptions.proxy`
* HTTP(S) or SOCKS proxy forwarded to the napi binding's `ConnectionOptions.proxy`
* (kernel `ProxyConfig`). The public `ConnectionOptions.proxy` is the
* Thrift-shaped `{protocol, host, port, auth}`; `buildKernelProxyOptions`
* maps it onto the kernel's structured proxy input — `url` composed from
Expand Down Expand Up @@ -820,18 +820,19 @@ export function buildKernelTelemetryOptions(
* credentials); `auth.{username,password}` are forwarded as separate
* basic-auth fields (the kernel applies them via reqwest `Proxy::basic_auth`),
* avoiding any URL percent-encoding footgun. The `noProxy` host list (a driver
* option, not on the published `.d.ts`) is forwarded as `bypassHosts`. The
* kernel accepts only `http://` / `https://`; a SOCKS protocol surfaces a clear
* kernel error at connect (reqwest SOCKS support is not compiled in).
* option, not on the published `.d.ts`) is forwarded as `bypassHosts`.
* `socks` becomes `socks5h` (proxy-side DNS, as on Thrift); the kernel
* rejects bare `socks://`. Other protocols pass through verbatim.
*/
export function buildKernelProxyOptions(options: ConnectionOptions): KernelProxyOptions {
const { proxy } = options;
if (!proxy) {
return {};
}
const { noProxy } = options as ConnectionOptions & { noProxy?: string };
const protocol = proxy.protocol === 'socks' ? 'socks5h' : proxy.protocol;
Comment thread
cathleeny marked this conversation as resolved.
Resolved
Comment thread
cathleeny marked this conversation as resolved.
Resolved
const out: NonNullable<KernelProxyOptions['proxy']> = {
url: `${proxy.protocol}://${proxy.host}:${proxy.port}`,
url: `${protocol}://${proxy.host}:${proxy.port}`,
};
if (proxy.auth?.username !== undefined) out.username = proxy.auth.username;
if (proxy.auth?.password !== undefined) out.password = proxy.auth.password;
Expand Down
5 changes: 3 additions & 2 deletions native/kernel/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions tests/unit/kernel/connectionOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
buildKernelTlsOptions,
buildKernelHttpOptions,
buildKernelRetryOptions,
buildKernelProxyOptions,
} from '../../../lib/kernel/KernelAuth';
import { ConnectionOptions } from '../../../lib/contracts/IDBSQLClient';
import HiveDriverError from '../../../lib/errors/HiveDriverError';
Expand Down Expand Up @@ -416,6 +417,47 @@ describe('KernelAuth HTTP options (buildKernelHttpOptions)', () => {
});
});

describe('KernelAuth proxy options (buildKernelProxyOptions)', () => {
const proxyUrl = (protocol: string) =>
buildKernelProxyOptions(opts({ proxy: { protocol, host: 'proxy.example', port: 1080 } })).proxy?.url;

// `socks` resolves at the proxy on Thrift (socks-proxy-agent), so it maps to
// `socks5h`; every other protocol keeps its own DNS mode.
const cases: Array<[string, string]> = [
['http', 'http://proxy.example:1080'],
['https', 'https://proxy.example:1080'],
['socks', 'socks5h://proxy.example:1080'],
['socks4', 'socks4://proxy.example:1080'],
['socks4a', 'socks4a://proxy.example:1080'],
['socks5', 'socks5://proxy.example:1080'],
['socks5h', 'socks5h://proxy.example:1080'],
];
for (const [protocol, url] of cases) {
it(`maps protocol '${protocol}' to ${url}`, () => {
expect(proxyUrl(protocol)).to.equal(url);
});
}

it('is empty without a proxy', () => {
expect(buildKernelProxyOptions(opts({}))).to.deep.equal({});
});

it('forwards credentials verbatim as separate fields, never in the URL', () => {
const auth = { username: 'u@:/#?', password: 'p@:/#?' };
const options = opts({ proxy: { protocol: 'socks', host: 'proxy.example', port: 1080, auth } });
expect(buildKernelProxyOptions(options)).to.deep.equal({
proxy: { url: 'socks5h://proxy.example:1080', username: auth.username, password: auth.password },
});
});

it('forwards noProxy as bypassHosts and folds into the full connection options', () => {
const native = buildKernelConnectionOptions(
opts({ proxy: { protocol: 'socks5', host: 'proxy.example', port: 1080 }, noProxy: 'h.databricks.com' }),
);
expect(native.proxy).to.deep.equal({ url: 'socks5://proxy.example:1080', bypassHosts: 'h.databricks.com' });
});
});

describe('KernelAuth retry options — buildKernelRetryOptions', () => {
// The driver's ClientConfig retry defaults (ms / total-attempt count).
const defaults = {
Expand Down
Loading