我有以下代码:
import org.apache.spark.sql.SparkSession
.
.
.
val spark = SparkSession
.builder()
.appName("PTAMachineLearner")
.getOrCreate()
当它执行时,我收到以下错误:
Exception in thread "main" java.lang.NoSuchMethodError: scala.Predef$.ArrowAssoc(Ljava/lang/Object;)Ljava/lang/Object;
at org.apache.spark.sql.SparkSession$Builder.config(SparkSession.scala:750)
at org.apache.spark.sql.SparkSession$Builder.appName(SparkSession.scala:741)
at com.acme.pta.accuracy.ml.PTAMachineLearnerModel.getDF(PTAMachineLearnerModel.scala:52)
代码编译和构建就好了。以下是依赖项:
scalaVersion := "2.11.11"
libraryDependencies ++= Seq(
// Spark dependencies
"org.apache.spark" %% "spark-hive" % "2.1.1",
"org.apache.spark" %% "spark-mllib" % "2.1.1",
// Third-party libraries
"net.sf.jopt-simple" % "jopt-simple" % "5.0.3",
"com.amazonaws" % "aws-java-sdk" % "1.3.11",
"org.apache.logging.log4j" % "log4j-api" % "2.8.2",
"org.apache.logging.log4j" % "log4j-core" % "2.8.2",
"org.apache.logging.log4j" %% "log4j-api-scala" % "2.8.2",
"com.typesafe.play" %% "play-ahc-ws-standalone" % "1.0.0-M9",
"net.liftweb" % "lift-json_2.11" % "3.0.1"
)
我正在执行这样的代码:
/Users/paulreiners/spark-2.1.1-bin-hadoop2.7/bin/spark-submit \
--class "com.acme.pta.accuracy.ml.CreateRandomForestRegressionModel" \
--master local[4] \
target/scala-2.11/acme-pta-accuracy-ocean.jar \
我用 Spark 1.6 运行了这一切。我正在尝试升级到 Spark 2,但缺少一些东西。