uros-b opened a new pull request, #58492:
URL: https://github.com/apache/spark/pull/58492
### What changes were proposed in this pull request?
Six Java ML tree test suites -- `JavaDecisionTreeClassifierSuite`,
`JavaGBTClassifierSuite`, `JavaRandomForestClassifierSuite`,
`JavaDecisionTreeRegressorSuite`, `JavaGBTRegressorSuite`,
`JavaRandomForestRegressorSuite` -- carried commented-out save/load round-trip
tests with a `// TODO: Add test once save/load are implemented. SPARK-6725`
marker.
Save/load has long shipped (`MLWritable` / `MLReadable`). This enables those
tests. The commented code was obsolete -- it used the old `save(SparkContext,
path)` / `load(SparkContext, path)` mllib API and referenced stale variable
names (`model2` / `model3`) -- so each block is rewritten to the current API:
```java
File tempDir = Utils.createTempDir(System.getProperty("java.io.tmpdir"),
"spark");
String path = new File(tempDir, "model").getPath();
try {
model.save(path);
<Model> sameModel = <Model>.load(path);
TreeTests.checkEqual(model, sameModel);
} finally {
Utils.deleteRecursively(tempDir);
}
```
### Why are the changes needed?
The blocks were dead (obsolete API and wrong variable names) rather than
merely disabled. Enabling them adds Java-facing save/load round-trip coverage
for the tree models, matching what the Scala suites already provide via
`DefaultReadWriteTest`.
### Does this PR introduce _any_ user-facing change?
No. Test-only.
### How was this patch tested?
Ran the six enabled Java suites locally; all pass.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)
--
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]