0
在嘗試Naive Bayes示例時here我在Ubuntu上的Spark 1.4上遇到此問題。我已經看到類似問題的帖子,其中修復了一個jar不匹配(通過Maven),但在這種情況下,所討論的類與Spark打包在一起,所以我不知道如何繼續。確切類型的火花類型不匹配
scala> val model = NaiveBayes.train(training, lambda = 1.0, modelType = "multinomial")
<console>:46: error: type mismatch;
found : org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.RDD[org.apache.spark.mllib.regression.LabeledPoint]
required: org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.RDD[org.apache.spark.mllib.regression.LabeledPoint]
val model = NaiveBayes.train(training, lambda = 1.0, modelType = "multinomial")
^
還要注意很長的類類型的鏈條:
org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.org.apache.spark.rdd.RDD
難道這是一些類加載器的bug?也許它正在尋找org.apache.spark.rdd.RDD,但發現錯誤的字符串(儘管該類實際上是正確的)。
相關: Apache Spark type mismatch of the same type (String)