You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2021/01/04 23:41:21 UTC
[spark] branch branch-3.1 updated: [SPARK-33894][SQL] Change
visibility of private case classes in mllib to avoid runtime compilation
errors with Scala 2.13
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 95e3414 [SPARK-33894][SQL] Change visibility of private case classes in mllib to avoid runtime compilation errors with Scala 2.13
95e3414 is described below
commit 95e34149ac2469efd71fba59e5dbdefd182d97f9
Author: Koert Kuipers <ko...@tresata.com>
AuthorDate: Mon Jan 4 15:40:32 2021 -0800
[SPARK-33894][SQL] Change visibility of private case classes in mllib to avoid runtime compilation errors with Scala 2.13
### What changes were proposed in this pull request?
Change visibility modifier of two case classes defined inside objects in mllib from private to private[OuterClass]
### Why are the changes needed?
Without this change when running tests for Scala 2.13 you get runtime code generation errors. These errors look like this:
```
[info] Cause: java.util.concurrent.ExecutionException: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 73, Column 65: failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 73, Column 65: No applicable constructor/method found for zero actual parameters; candidates are: "public java.lang.String org.apache.spark.ml.feature.Word2VecModel$Data.word()"
```
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Existing tests now pass for Scala 2.13
Closes #31018 from koertkuipers/feat-visibility-scala213.
Authored-by: Koert Kuipers <ko...@tresata.com>
Signed-off-by: Dongjoon Hyun <dh...@apple.com>
(cherry picked from commit 9b4173fa95047fed94e2fe323ad281fb48deffda)
Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala | 2 +-
.../main/scala/org/apache/spark/mllib/clustering/KMeansModel.scala | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala b/mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala
index 9b5f5a6..5e4ccd0 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala
@@ -338,7 +338,7 @@ class Word2VecModel private[ml] (
@Since("1.6.0")
object Word2VecModel extends MLReadable[Word2VecModel] {
- private case class Data(word: String, vector: Array[Float])
+ private[Word2VecModel] case class Data(word: String, vector: Array[Float])
private[Word2VecModel]
class Word2VecModelWriter(instance: Word2VecModel) extends MLWriter {
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeansModel.scala b/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeansModel.scala
index 04a3b6d..a24493b 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeansModel.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeansModel.scala
@@ -145,9 +145,9 @@ object KMeansModel extends Loader[KMeansModel] {
}
}
- private case class Cluster(id: Int, point: Vector)
+ private[KMeansModel] case class Cluster(id: Int, point: Vector)
- private object Cluster {
+ private[KMeansModel] object Cluster {
def apply(r: Row): Cluster = {
Cluster(r.getInt(0), r.getAs[Vector](1))
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org