我正在使用DSE Spark Job Server。我嘗試完成的任務如下:Spark Job Server中的Java程序引發scala.MatchError
我在Java中創建的Spark任務預計會從cassandra db中獲取一些數據,並將部署到DSE Analytics羣集中。
的代碼如下:
package com.symantec.nsp.analytics;
import static com.datastax.spark.connector.japi.CassandraJavaUtil.javaFunctions;
import static com.datastax.spark.connector.japi.CassandraJavaUtil.mapRowTo;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.apache.spark.SparkContext;
import org.apache.spark.api.java.JavaSparkContext;
import spark.jobserver.JavaSparkJob;
import spark.jobserver.SparkJobInvalid;
import spark.jobserver.SparkJobValid$;
import spark.jobserver.SparkJobValidation;
import com.symantec.nsp.analytics.model.Bucket;
import com.typesafe.config.Config;
public class JavaSparkJobBasicQuery extends JavaSparkJob {
public String runJob(JavaSparkContext jsc, Config config) {
try {
List<UUID> bucketRecords = javaFunctions(jsc).cassandraTable("nsp_storage", "bucket", mapRowTo(Bucket.class))
.select("id", "deleted").filter(s -> s.getDeleted()).map(s -> s.getId()).collect();
System.out.println(">>>>>>>> Total Buckets getting scanned by Spark :" + bucketRecords.size());
return bucketRecords.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public SparkJobValidation validate(SparkContext sc, Config config) {
return null;
}
public String invalidate(JavaSparkContext jsc, Config config) {
return null;
}
}
問題:
在行使這個代碼我得到了下面的問題:
"status": "ERROR",
"result":
"message": "null",
"errorClass": "scala.MatchError",
"stack": ["spark.jobserver.JobManagerActor$$anonfun$spark$jobserver$JobManagerActor$$getJobFuture$4.apply(JobManagerActor.scala:244)", "scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)", "scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)", "java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)", "java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)", "java.lang.Thread.run(Thread.java:745)"]
有人能解決這個問題。 注意:我試過多次清洗/tmp
文件夾。無法解決這個問題。我使用的DSE版本是4.8.10。