我是spark的新手,我使用以下代码定义spark对象:
SparkSession spark = SparkSession
.builder()
.appName("Java Spark basic example")
.config("spark.master", "local")
.getOrCreate();
我收到此异常:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.spark.sql.SQLContext.<init>(Lorg/apache/spark/sql/SparkSession;)V
at org.apache.spark.sql.SparkSession.<init>(SparkSession.scala:159)
at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:957)
at Spark.main(Spark.java:26)
它指向我写的第26行:.config(“ spark.master”,“ local”)。
能否请您解释为什么我会收到此错误以及如何纠正该错误?
答案 0 :(得分:-1)
检查JAVA API docs。下面的代码片段应该可以工作:
master cache-last sort-after prio-queue
--------------------------------------------------------------------------------------------
GIT_PERF_REPO=git.git
0.52(0.50+0.02) 0.53(0.51+0.02) +1.9% 0.37(0.33+0.03) -28.8% 0.37(0.32+0.04) -28.8%
GIT_PERF_REPO=linux.git
20.81(20.74+0.07) 20.31(20.24+0.07) -2.4% 0.94(0.86+0.07) -95.5% 0.91(0.82+0.09) -95.6%
GIT_PERF_REPO=llvm-project.git
83.67(83.57+0.09) 4.23(4.15+0.08) -94.9% 3.21(3.15+0.06) -96.2% 2.98(2.91+0.07) -96.4%