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

   ### What changes were proposed in this pull request?
   
   The live ML API cases record their results with the shared `Recorder` of 
`python/tests/_ml_api_cases.py`. It records a DataFrame by the repr of its 
rows, so a double that differs in its last bits between CI's Linux Spark server 
and a local one fails the comparison. For example, a threshold of a curve is 
0.22179308431466782 on one and 0.2217930843146675 on the other. The families 
have worked around it each on their own, with `_Rounded` wrappers 
(LogisticRegression, the trees, NaiveBayes/MLP/FM/OneVsRest), 
`RegressionRecorder(rounded=True)`, and `round()` calls on single cases.
   
   This PR makes rounding the Recorder's default:
   
   - `Recorder(rounded=True)` is the default. Floats in DataFrame rows, lists 
and ML vectors and matrices are rounded to 9 decimals, with -0.0 as 0.0, as a 
bare float already was. `rounded=False` remains possible.
   - The families' own rounding is removed: the `_Rounded` wrappers, 
RegressionRecorder's override (its error normalization stays), and the per-case 
`round()` calls that the default now covers. Rounding that has to happen before 
a sort, such as the cluster centers, stays.
   - Every golden that a Recorder writes is recaptured on official PySpark 
4.3.0 with its family's capture script. That covers ml_api, logistic_api, 
tree_api, misc_api, regression_api, clustering_api, evaluation_api, feature_api 
and fpm_recommendation_api.
     - Each capture was run twice, and the two runs are identical.
     - Only two goldens change. In `ml_api_cases.json`, LinearSVC's four curve 
DataFrames now record rounded rows, so their rows, which sort by repr, change 
order. In `fpm_recommendation_api_cases.json`, the same happens to ALS's two 
transforms.
     - The other seven goldens are byte-identical.
   
   ### Why are the changes needed?
   
   So the live ML cases compare equal across platforms by default, without each 
family adding its own workaround.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, tests only.
   
   ### How was this patch tested?
   
   - A checker walks the old and new goldens together. Every changed leaf is 
equal after rounding the floats on both sides to 9 decimals, the two changed 
lists are equal as multisets, and the key sets are identical.
   - Every family's offline and e2e test files pass on this client against a 
Spark 4.3.0 Connect server, and on official PySpark as the reference.
     - The official runs of test_evaluation_api_offline.py and 
test_feature_api_offline.py fail to start their mock server in this local 
reference environment. The same happens at the base commit, so those runs are 
environment-limited.
   - The offline Python suite of the coverage job passes.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
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