Scala 为什么运行Spark应用程序时使用;“sbt运行”;在SBT1.0.x中失败?
我有一个简单的Spark项目,我尝试使用Scala 为什么运行Spark应用程序时使用;“sbt运行”;在SBT1.0.x中失败?,scala,apache-spark,sbt,apache-spark-sql,Scala,Apache Spark,Sbt,Apache Spark Sql,我有一个简单的Spark项目,我尝试使用sbt-run运行它。但是,它会在codegen期间导致异常: 17/12/13 15:19:27 ERROR CodeGenerator: failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 15, Column 34: Cannot determine simple type name "scala" /* 001
sbt-run
运行它。但是,它会在codegen期间导致异常:
17/12/13 15:19:27 ERROR CodeGenerator: failed to compile: org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 15, Column 34: Cannot determine simple type name "scala"
/* 001 */ public Object generate(Object[] references) {
/* 002 */ return new GeneratedIterator(references);
/* 003 */ }
/* 004 */
/* 005 */ final class GeneratedIterator extends org.apache.spark.sql.execution.BufferedRowIterator {
/* 006 */ private Object[] references;
/* 007 */ private scala.collection.Iterator[] inputs;
/* 008 */ private org.apache.spark.sql.execution.metric.SQLMetric scan_numOutputRows;
/* 009 */ private scala.collection.Iterator scan_input;
/* 010 */
/* 011 */ public GeneratedIterator(Object[] references) {
/* 012 */ this.references = references;
/* 013 */ }
/* 014 */
/* 015 */ public void init(int index, scala.collection.Iterator[] inputs) {
/* 016 */ partitionIndex = index;
/* 017 */ this.inputs = inputs;
/* 018 */ this.scan_numOutputRows = (org.apache.spark.sql.execution.metric.SQLMetric) references[0];
/* 019 */ scan_input = inputs[0];
/* 020 */
/* 021 */ }
/* 022 */
/* 023 */ protected void processNext() throws java.io.IOException {
/* 024 */ while (scan_input.hasNext()) {
/* 025 */ InternalRow scan_row = (InternalRow) scan_input.next();
/* 026 */ scan_numOutputRows.add(1);
/* 027 */ append(scan_row);
/* 028 */ if (shouldStop()) return;
/* 029 */ }
/* 030 */ }
/* 031 */ }
org.codehaus.commons.compiler.CompileException: File 'generated.java', Line 15, Column 34: Cannot determine simple type name "scala"
spark submit
不会发生这种情况。生成定义最少:
name := "untitled"
version := "0.1"
scalaVersion := "2.11.12"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-sql" % "2.2.1"
)
代码(我会发布它,有人认为它是相关的,但我相信问题是通用的)和build.properties
:
sbt.version = 1.0.4
据我所知,发生这种情况是因为Spark在运行时找不到Scala库-这是否正确?我最近注意到,使用sbt 1.0.x会通过
sbt run
以某种方式中断Spark应用程序的执行
我的猜测是,根本原因可能是SBT1.0.x在封面下使用的Scala 2.12.x以某种方式触发了问题
在问题解决之前,我建议使用
Spark submit
运行Spark应用程序。这可能还与sbt 1中的bgrun更改有关,这是对sbt run
功能的一个非常基本的更改