Skip to content

fix(thrift): warn and fall back to 10 for invalid max_download_threads - #1090

Open
atharva18-hue wants to merge 1 commit into
databricks:mainfrom
atharva18-hue:fix/cloudfetch-max-download-threads-903
Open

atharva18-hue wants to merge 1 commit into
databricks:mainfrom
atharva18-hue:fix/cloudfetch-max-download-threads-903

Conversation

@atharva18-hue

Copy link
Copy Markdown

Fixes #903 (CLOUDFETCH-019).

Problem

The Thrift backend forwarded a non-positive max_download_threads straight to ThreadPoolExecutor(max_workers=...), so a client-side tuning typo (e.g. max_download_threads=0) made the first CloudFetch-sized query raise ValueError: max_workers must be greater than 0 instead of running.

Fix

Validate the knob in ThriftDatabricksClient.__init__ via a new _coerce_max_download_threads() helper: an invalid value (bool, non-int, or <= 0) logs a warning and falls back to the default of 10, so the session opens and queries run. The validation shape mirrors the kernel backend, which raises ValueError for the same knob — Thrift warns and defaults instead, because the conformance expectation is that an invalid client-side knob value must not fail session open.

Tests

  • 13 new unit tests in tests/unit/test_thrift_backend.py: invalid values (0, -1, None, "4", 1.5, True) coerce to 10 with a warning; valid values pass through; client construction with 0 / -3 yields max_download_threads == 10.
  • test_thrift_backend.py + test_download_manager.py + test_retry.py: 127 passed, 82 skipped (pyarrow-gated tests skipped locally — the sandbox NumPy is 1.26.4 and pyarrow needs >= 2.0; CI covers them).
  • Revert check: without the fix the client stores 0 as-is; with the fix it stores 10.
  • Ruff: zero new findings vs the pristine baseline.

Notes

  • The conformance xfail test named in the issue lives in the private driver-test repo, so it cannot be run here — CI / E2E is the check.
  • The SEA backend stores the same knob without validation but never feeds it to a ThreadPoolExecutor, so it is out of scope here.

Signed-off-by: Atharva Chavhan atharvachavhan18@gmail.com

A non-positive (or non-integer) max_download_threads was forwarded
unvalidated to ThreadPoolExecutor(max_workers=...), so the first
CloudFetch-sized query raised ValueError instead of running. Validate
the knob in ThriftDatabricksClient.__init__: warn and use the default
of 10, mirroring the kernel backend validation shape (which raises)
but keeping the session open, as the conformance expectation requires.

Fixes databricks#903 (CLOUDFETCH-019).

Signed-off-by: Atharva Chavhan <atharvachavhan18@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[coverage] Conformance findings: CLOUDFETCH-019

1 participant