Repository navigation
Conversation
Document arraysize, buffer_size_bytes and row_limit for Thrift and Kernel. Clarify that fetchmany(size) requires an explicit size and that kernel fetches slice server-selected batches without forwarding fetch knobs. Add hermetic coverage for exact fetchmany slices across kernel batches, inert arraysize/buffer_size_bytes and row_limit forwarding. Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Low
Looks good, with 1 low concern. The documented defaults (100000 and 104857600) and the kernel behavior (set_row_limit is forwarded, arraysize/max_bytes are ignored) match the source. The only issue is test isolation: the duplicated fake-kernel stub makes test results depend on the order test files are imported.
test_kernel_fetch_size.py installed its own databricks_sql_kernel stub with a separate KernelError class. When that file was imported before test_kernel_client.py, client.py bound the wrong class and two client tests failed. Reuse test_kernel_client.py's stub and assert both files see the same KernelError. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Nit
Looks good, no blocking issues. The docs match the code: defaults are 100000 and 104857600, the kernel always calls set_row_limit, and fetchmany takes an explicit size on both backends. The test_downloader.py changes (time-mock fix and black reformatting) are not mentioned in the PR description.
Other findings
- ⚪ Nit — Test comments say arraysize is "honored client-side" or "only slices client-side", but on the kernel it is only stored on the result set, and the explicit fetchmany(size) does the slicing. Reword the comments to match the code and the new docs. (Found by Claude Opus 5.5 · confirmed by the judge)
Summary
On kernel connections (
use_kernel=True), the cursor's fetch-size options behave differently from Thrift, and thatwasn't documented. This PR documents
arraysize,buffer_size_bytesandrow_limitfor each backend and adds unittests that pin the kernel behavior. No runtime code changes.
What changes
CONNECTION_PARAMETERS.md: a new "Cursor fetch options" table.arraysize: Thrift sends it to the server. The kernel picks its own batch sizes, andfetchmany(n)stillreturns exactly
nrows.buffer_size_bytes: Thrift only; ignored on the kernel.row_limit: works on both.fetchmany(size)needs an explicit size on both backends.tests/unit/test_kernel_fetch_size.py: exactfetchmanysizes across kernel batches,arraysizeandbuffer_size_bytesnot forwarded, androw_limitpassed to the kernel.Testing
Live, connector from this branch with
databricks-sql-kernel1.5.0:range(100000),arraysize=1000:fetchmany(1000)returns 100 × 1000 rowsrange(100000), defaultarraysize: all rowsfetchmany(10000): 200 × 10000 rows, over CloudFetchrow_limit=500: 500 rowsOn the kernel, batch sizes (4096 rows on DBSQL, 781 on Reyden) are the same whatever
arraysizeis.Unit:
tests/unit(1453 passed), the real-kernel tests, black and mypy pass.Not run: Thrift on Reyden (Reyden doesn't support Thrift); other Python versions (CI).
Dependencies
None.
This pull request and its description were written by Isaac.