dbtsai opened a new pull request, #399:
URL: https://github.com/apache/spark-connect-rust/pull/399

   ### What changes were proposed in this pull request?
   
   Validate native Rust `DataFrame::random_split` weights before constructing 
sampling plans. Return structured `VALUE_NOT_POSITIVE` errors for the first 
negative weight or a nonpositive total, including empty and all-zero inputs. 
Update the Python binding and every in-repository native caller to handle the 
result.
   
   The independent patch is based on master 
0ac7a0f4e8c98a2d13157175b20c9ebb3c536c28.
   
   ### Why are the changes needed?
   
   The Rust method currently constructs plans for negative weights and zero 
totals, and an empty list silently returns no frames. PySpark rejects these 
inputs before constructing splits. For example, `random_split(vec![-1.0, 2.0], 
Some(42))` now returns `VALUE_NOT_POSITIVE` with `arg_name=weights`; an empty 
input reports `arg_name=sum(weights)`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The Rust return type changes from `Vec<DataFrame>` to 
`Result<Vec<DataFrame>>`. Downstream native callers must use `?` or handle the 
error explicitly. All in-repository callers are updated.
   
   The Python wrapper retains its validation first, preserving error values 
formatted from the original Python input. Native errors use Rust float 
formatting. Valid weights retain shared seeds, deterministic ordering and 
zero-weight splits when the total is positive. NaN and positive infinity retain 
PySpark's comparison semantics; server acceptance of every nonfinite plan 
remains outside this fix.
   
   ### How was this patch tested?
   
   - Formatting, release core/API library tests, integration-test compilation 
with and without `wasm-udf`, and the native extension build passed. The offline 
Python suites recorded **2,579 passed and 8 inherited live-server skips**.
   - All three new native unit tests passed: invalid weights before plan 
construction, serialized normalized bounds/shared seed/ordering, and nonfinite 
comparison semantics. Both updated native live callers passed against Spark: 
`dataframe_metadata_json_semantics` and 
`replace_to_with_metadata_random_split`, each **1 passed / 0 ignored**.
   - Introspection completed across 12 API groups and passed the public-name 
gate. This checks names, not complete signatures or behavior. The no-stubs 
audit passed. Complete source review round 7 reported no findings. Review and 
validation source manifests match, and the saved extension hash matches its 
validation receipt.
   - This artifact's official configuration and DataFrame-creation plugin smoke 
passed against a live Spark 4.3 JVM: **5 + 18 passed, 1 skipped**, including 
four remote-mode guard passes. The missing-pandas test was skipped because 
pandas was installed. These tests exercise the official Python client through 
this artifact's raw-transport plugin; the changed native sampling behavior is 
covered separately above.
   - Shared raw-transport regression coverage is carried from the pandas 
artifact, which executed the full ordinary phase (**87 modules: 2,586 passed, 
641 skipped, 1 manifest deselection**) and the separate cluster/resource phase 
(**4 modules: 15 passed, 14 skipped**, including 10 functional passes and five 
guards), with zero unexpected failures. The ordinary drift check retained one 
expected missing-catalog failure. All 53 assessed shared transport/build inputs 
match this candidate. This is common-source evidence plus this artifact's own 
smoke and native checks; this artifact has no executed full official-suite or 
cluster pass, and source equality does not establish binary equivalence.
   - Fresh workspace/all-target Clippy exited **101**. Its **483 source 
diagnostics and 732 primary/secondary spans** map to unchanged statements in 
saved master source, with no emitted span on an own-changed statement. This 
inherited-source failure remains recorded; source attribution establishes 
neither a passing Clippy run nor an executed pristine-master lint comparison.
   
   Retained receipts do not provide complete official-source/dependency 
whole-tree start/end attestations, raw per-module pytest return codes or 
per-case skip provenance. Result-log hashes are assessment-time observations. 
Rejected static fixture overrides mean the plugin tests do not establish forced 
short-stream reattachment. Donor totals count executions; these scoped results 
do not establish complete API or whole-client parity.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex
   
   This pull request and its description were written by OpenAI Codex.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to