Skip to content
Open
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
@@ -1,6 +1,7 @@
# Release History

# Unreleased
- Honor `enable_query_result_lz4_compression` on kernel connections (`use_kernel=True`).
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
- Support `credentials_provider` on kernel connections (`use_kernel=True`), with the same header refresh and token federation as Thrift.
- Honor `_port` and `_connection_uri` on kernel connections (`use_kernel=True`), as Thrift does. Requires a databricks-sql-kernel release that includes databricks/databricks-sql-kernel#505.
- Speed up `fetchone()`, `fetchmany()` and `fetchall()` by building each result `Row` with fewer Python calls. The rows are unchanged. Large results and many concurrent cursors in one process benefit most.
Expand Down
14 changes: 6 additions & 8 deletions CONNECTION_PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ environment. The backends differ for SOCKS proxies:
| ------------------------------------- | ------ | :----: | :----: | ------------- | ------------------------------------------------------------------------------------------------------------- |
| `use_cloud_fetch` | `bool` | ✅ | ✅ | `True` | Set `False` at connection creation to fetch complete results without cloud-storage downloads. On the kernel path, changing this attribute after connecting does not change result delivery. |
| `max_download_threads` | `int` | ✅ | ✅ | `16` kernel, `10` Thrift | CloudFetch download window; on the kernel, counts downloading and queued chunks ahead of consumption, excluding consumer buffers. Not a byte limit. |
| `enable_query_result_lz4_compression` | `bool` | ✅ | ❌ | `True` | LZ4-compress result payloads. Not forwarded; the kernel handles compression internally. |
| `enable_query_result_lz4_compression` | `bool` | ✅ | ✅ | `True` | Request LZ4 compression for Arrow results. Set `False` to request uncompressed results. |
Comment thread
oss-reviewer-bot[bot] marked this conversation as resolved.
Resolved
| `_disable_pandas` | `bool` | ✅ | ✅ | `False` | Skip the pandas-based Arrow→row deserialization and materialize rows directly with PyArrow. This is a **Python-side** result-conversion toggle, not a wire option: the kernel returns results as Arrow (`RecordBatch`es) and the connector runs the *same* `_convert_arrow_table` for both backends, so the flag is honored on the kernel path too. Affects only row fetches (`fetchone`/`fetchmany`/`fetchall`); the `fetch*_arrow` methods return the Arrow table unchanged regardless of this flag. |
| `enable_geospatial_support` | `bool` | ❌ | ✅ | `False` | Return GEOMETRY / GEOGRAPHY as `{"srid": int, "wkb": bytes}` values when `True`, or as WKT / EWKT strings when `False`. This is a local result conversion and is never forwarded to SEA. |
| `_use_arrow_native_complex_types` | `bool` | ✅ | ✅ | `True` | Return `ARRAY`/`MAP`/`STRUCT` as native Arrow types instead of JSON strings. Forwarded to the kernel. |
Expand Down Expand Up @@ -224,16 +224,14 @@ are forwarded when supported by the installed kernel binding.
2. `experimental_oauth_persistence` (custom OAuth token store).
3. TLS-client-cert *authentication* (`_use_cert_as_auth`) — note the TLS
*transport* options (`_tls_*`) themselves **are** honored on both backends.
4. Result-transport tuning:
`enable_query_result_lz4_compression`.
5. Arrow-native rendering for `_use_arrow_native_decimals` /
4. Arrow-native rendering for `_use_arrow_native_decimals` /
`_use_arrow_native_timestamps` (complex types **are** forwarded).
6. `staging_allowed_local_path` (Volume `PUT`/`GET`).
7. Retry fine-tuning beyond the four forwarded knobs: `_retry_delay_default`,
5. `staging_allowed_local_path` (Volume `PUT`/`GET`).
6. Retry fine-tuning beyond the four forwarded knobs: `_retry_delay_default`,
`_retry_dangerous_codes`, `_respect_server_retry_after_header`,
`_retry_max_redirects`, `_enable_v3_retries`.
8. `force_enable_telemetry`.
9. `_pool_connections` and `_proxy_auth_method` do not configure the
7. `force_enable_telemetry`.
8. `_pool_connections` and `_proxy_auth_method` do not configure the
kernel-owned network stack.

### Supported on Kernel, missing / ignored on Thrift
Expand Down
1 change: 1 addition & 0 deletions src/databricks/sql/backend/kernel/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ def execute_command(
try:
stmt.set_sql(operation)
stmt.set_row_limit(row_limit)
stmt.set_lz4_compression(bool(lz4_compression))
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
if query_tags:
# Per-statement query tags. The kernel serialises the
# dict (None value -> bare key) into the SEA
Expand Down
38 changes: 37 additions & 1 deletion tests/unit/test_kernel_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import types
from concurrent.futures import ThreadPoolExecutor
from typing import Optional
from unittest.mock import MagicMock
from unittest.mock import call, MagicMock

import pytest

Expand Down Expand Up @@ -1139,6 +1139,42 @@ def test_execute_command_forwards_row_limit(row_limit):
stmt.set_row_limit.assert_called_once_with(row_limit)


@pytest.mark.parametrize("async_op", [False, True])
def test_execute_command_forwards_lz4_compression_before_dispatch(async_op):
client = _make_client()
client._kernel_session = MagicMock()
cursor = MagicMock(arraysize=100, buffer_size_bytes=1024)
cases = [(True, True), (False, False), (0, False)]
statements = [MagicMock() for _ in cases]
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
Comment thread
aakash-saravanan-db marked this conversation as resolved.
Resolved
client._kernel_session.statement.side_effect = statements

for stmt, (value, expected) in zip(statements, cases):
stmt.execute.return_value = MagicMock(
statement_id="stmt-id",
arrow_schema=MagicMock(return_value=pa.schema([("x", pa.int64())])),
)
stmt.submit.return_value.statement_id = "stmt-id"
client.execute_command(
operation="SELECT 1",
session_id=MagicMock(),
max_rows=1,
max_bytes=1,
lz4_compression=value,
cursor=cursor,
use_cloud_fetch=True,
parameters=[],
async_op=async_op,
enforce_embedded_schema_correctness=False,
)

dispatch = call.submit() if async_op else call.execute()
stmt.set_lz4_compression.assert_called_once_with(expected)
assert stmt.set_lz4_compression.call_args.args[0] is expected
assert stmt.method_calls.index(call.set_lz4_compression(expected)) < (
stmt.method_calls.index(dispatch)
)


# ---------------------------------------------------------------------------
# Staging / volume operations — fail loud (not silently no-op)
# ---------------------------------------------------------------------------
Expand Down
Loading