Repository navigation
[Data] Validate authentication and TLS configurations for read_hive (#67072) - #67168
ArjunPakhan wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request enhances HiveServer2 connection error handling and validation in Ray Data by classifying exceptions (such as TLS, Kerberos, and credential failures) into descriptive error messages, validating connection objects, and updating relevant documentation and tests. Feedback on the changes identifies a NameError in the integration tests due to an undefined helper function, and a potential resource leak in the connection validation logic where an invalid connection object with a close method is not closed before raising a TypeError.
d7cf0c9 to
a76ff26
Compare
|
Thank you @gemini-code-assist and @cursor for the thorough code reviews! I've pushed an update addressing all the feedback:
All checks are re-running and everything is in order. Ready for a human maintainer review! |
|
Thank you for the update. The changes to |
…EXAMPLE doctests (#67209) ## Description Converts the never-run `.. testcode::` / `:skipif: True` examples for Ray Data's external-service sinks and the Hive reader to `>>>` doctests. Each docstring is flagged once with the docstring-level `# doctest: +SKIP_EXAMPLE` from #66753. The change touches only docstrings: - **`python/ray/data/dataset.py`**: 10 blocks in `write_iceberg`, `write_delta`, `write_webdataset`, `write_snowflake`, `write_mongo`, `write_bigquery`, `write_clickhouse`, `write_turbopuffer` (2 blocks), and `write_kafka`. - **`python/ray/data/read_api.py`**: the `read_hive` example. - **`python/ray/data/_internal/datasource/turbopuffer_datasink.py`**: the 3 `TurbopufferDatasink` examples. Each example needs a service, credentials, or a bucket that CI doesn't have, so they stay render-only, as before. The flag is stripped at render time by both Sphinx (`trim_doctest_flags`) and griffe. The conversion follows the rules from #67080: same code in the same order, blank lines inside a block dropped, and top-level comments as `>>> #` lines. Two docstrings needed something other than the flag: - **The `Dataset` class docstring runs its example now.** That docstring also holds 10 runnable `>>>` examples, and `+SKIP_EXAMPLE` skips a whole docstring, so it would have stopped them from running. Instead, only the two lines that use placeholder paths, `read_parquet("s3://bucket/path")` and `write_csv("s3://bucket/output")`, carry `# doctest: +SKIP`. The `range` and `from_items` lines run. - **`write_csv`'s example had an unterminated string**, `"s3://bucket/folder/)`. It was already `+SKIP`, so nothing ever parsed it. The closing quote is now in place, so the docstring parses with the stock doctest parser. The `:skipif: True` blocks left in `dataset.py` after this PR are in #67202 (`join`) and #67207 (`streaming_split`). ## Related issues Related to #66753, #67080, #67202, and #67207. ## Additional information **Not a duplicate.** I searched open PRs for each method name, `turbopuffer`, `SKIP_EXAMPLE`, and `testcode skipif data`. #67202 and #67207 are my own and convert other methods in `dataset.py`. Two open PRs edit text these examples sit next to, so whichever PR lands second needs a small rebase: - #66192 edits the `write_iceberg` example's content, adding a REST catalog write. This PR changes only the example's form. - #66308 adds a deprecation notice to `write_clickhouse`, next to its example. #67114 and #67168 change `read_api.py` but not the `read_hive` docstring example. **Tests run** - `ci/ray_ci/doc/check_docstring_only.py --base upstream/master`: "3 file(s), docstrings only." - `ci/ray_ci/doc/run_docstring_examples.py` on the three files, in an aarch64 image with the Ray nightly at `093faf5583e` and the changed files mounted over the installed ones. None of the three files changed between that commit and this PR's base. Result: 85 docstrings run and 1 failed, with 16 skipped for `+SKIP_EXAMPLE` and 5 for an omitted library (torch, torchvision, TensorFlow, `tensorflow_datasets`). All 13 converted docstrings report `SKIP (+SKIP_EXAMPLE)`, and `Dataset` and `Dataset.write_csv` pass. The one failure is `read_videos`, which this PR doesn't touch. It needs `decord`, which has no aarch64 wheel. The run installed `datasketches`, `Pillow`, `crc32c`, `soundfile`, and `fastavro`, which the base image lacks. Without them, six more untouched docstrings fail on the missing import. - Every `>>>` example in the three files compiles with the stock `doctest` parser once `SKIP_EXAMPLE` is registered. - `pre-commit run --files` on the three files: all hooks pass, including ruff, black, pydoclint, and the Ray docstyle check. The PR carries the `docstring-only` label, and its commit carries an `@rtd-build` line for the Read the Docs preview. AI assistance (Claude Code) was used for this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
|
@jiangxt2 could you take a look at this one as well? |
jiangxt2
left a comment
There was a problem hiding this comment.
Thanks for working on this! My main concern is that the implementation focuses on error classification and does not yet demonstrate the real-server Kerberos/GSSAPI and verified TLS compatibility requested by #67072, covering both driver metadata lookup and worker reads. The diagnostics also depend on client-specific error wording and exception chains that Thrift may not preserve, making some classifications unreliable. The job_config.py change also appears unrelated to this scope.
BTW, this also overlaps with my draft PR #67273, which addresses the real-service authentication/TLS validation requested by #67072.
a76ff26 to
641d750
Compare
|
Hi @jiangxt2, thank you for the detailed feedback! To address your points:
Please let me know if you would like any additional adjustments or mock-server enhancements! |
641d750 to
a607e30
Compare
cd6214e to
90ee006
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 90ee006. Configure here.
…read_hive Signed-off-by: Arjun Pakhan <[email protected]>
90ee006 to
5582be4
Compare
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |

Summary
Resolves issue #67072 by implementing robust validation, root-cause error classification, and fail-closed lifecycle handling for authentication (Kerberos/GSSAPI) and TLS configurations in
read_hive. This follows up on PR #66573.Key Changes
_classify_error_detail):impyla[kerberos]dependencies, expired ticket caches /kinit, principal or service name configuration errors), and credential rejections (PLAIN/LDAP/SASL auth failures)._connect,infer_table_schema(driver-side metadata), andread_hs2_batches(worker-side batch reads) to validate connection factories upfront.finallyblocks) on connection failure with no-replay guarantees (max_retries: 0).read_api.pydocstrings andloading-data.mdto clearly document supported authentication profiles (PLAIN, GSSAPI, NOSASL, LDAP), TLS requirements, and distributed node prerequisites.test_hive_hs2.pycovering all TLS/Kerberos/auth failure modes.test_hive.pyverifying driver-side and worker-side validation behavior and successful multi-node data reads.Verification
ruff, formatting, linting, and type checking).test_hive.py,test_hive_lifecycle.py,test_hive_hs2.py, etc.).