Scala Vegas Bar NoSuchMethodError-带数据帧

Scala Vegas Bar NoSuchMethodError-带数据帧,scala,apache-spark,apache-spark-sql,data-visualization,vegas-viz,Scala,Apache Spark,Apache Spark Sql,Data Visualization,Vegas Viz,我正在使用维加斯图书馆在Scala中用Jupyter笔记本中的Spark进行简单的可视化实验 我已经成功地安装了杏仁内核并导入了所有必要的方法。我可以启动SparkSession并使用Scala代码而不会出现问题 然而,当涉及到实际绘制带有Spark数据框的条形图时,似乎无法识别withDataFrame方法。请告知 import $ivy.`org.vegas-viz:vegas_2.11:0.3.11` import $ivy.`org.vegas-viz:vegas-spark_2.11:

我正在使用维加斯图书馆在Scala中用Jupyter笔记本中的Spark进行简单的可视化实验

我已经成功地安装了杏仁内核并导入了所有必要的方法。我可以启动SparkSession并使用Scala代码而不会出现问题

然而,当涉及到实际绘制带有Spark数据框的条形图时,似乎无法识别withDataFrame方法。请告知

import $ivy.`org.vegas-viz:vegas_2.11:0.3.11`
import $ivy.`org.vegas-viz:vegas-spark_2.11:0.3.11`
import $ivy.`org.apache.spark::spark-sql:2.4.0`
import $ivy.`sh.almond::almond-spark:0.10.6`

import org.apache.spark.sql._
import org.apache.spark.sql.types

val spark = {
  NotebookSparkSession.builder()
    .master("local[*]")
    .getOrCreate()
}

val intDF = spark.read.option("header","true").csv("customer_interactions.csv")

import vegas._
import vegas.render.WindowRenderer._
import vegas.sparkExt._

val plotDF = intDF.groupBy("offer").count

plotDF.schema
res11: types.StructType = StructType(
  StructField("offer", StringType, true, {}),
  StructField("count", LongType, false, {})
)

Vegas("Offer Count")
    .withDataFrame(plotDF)
    .encodeX("offer", Ordinal)
    .encodeY("count", Quantitative)
    .mark(Bar)
    .show

**ERROR Execute exception in user code (scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;)
java.lang.NoSuchMethodError:** scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
  vegas.sparkExt.package$VegasSpark.withDataFrame(package.scala:16)
  ammonite.$sess.cmd35$Helper.<init>(cmd35.sc:2)
  ammonite.$sess.cmd35$.<init>(cmd35.sc:7)
  ammonite.$sess.cmd35$.<clinit>(cmd35.sc)
  ammonite.$sess.cmd35.$main(cmd35.sc)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  java.lang.reflect.Method.invoke(Method.java:498)
  ammonite.runtime.Evaluator$$anon$1.$anonfun$evalMain$1(Evaluator.scala:108)
  ammonite.util.Util$.withContextClassloader(Util.scala:24)
  ammonite.runtime.Evaluator$$anon$1.evalMain(Evaluator.scala:90)
  ammonite.runtime.Evaluator$$anon$1.$anonfun$processLine$2(Evaluator.scala:127)
  ammonite.util.Catching.map(Res.scala:117)
  ammonite.runtime.Evaluator$$anon$1.$anonfun$processLine$1(Evaluator.scala:121)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.runtime.Evaluator$$anon$1.processLine(Evaluator.scala:120)
  ammonite.interp.Interpreter.$anonfun$evaluateLine$4(Interpreter.scala:296)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$evaluateLine$2(Interpreter.scala:282)
  ammonite.util.Catching.flatMap(Res.scala:115)
  ammonite.interp.Interpreter.evaluateLine(Interpreter.scala:281)
  ammonite.interp.Interpreter.$anonfun$processLine$6(Interpreter.scala:268)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$processLine$4(Interpreter.scala:252)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  ammonite.interp.Interpreter.$anonfun$processLine$2(Interpreter.scala:245)
  ammonite.util.Catching.flatMap(Res.scala:115)
  ammonite.interp.Interpreter.processLine(Interpreter.scala:244)
  almond.Execute.$anonfun$ammResult$9(Execute.scala:226)
  almond.internals.CaptureImpl.$anonfun$apply$2(CaptureImpl.scala:53)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
  scala.Console$.withErr(Console.scala:196)
  almond.internals.CaptureImpl.$anonfun$apply$1(CaptureImpl.scala:45)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
  scala.Console$.withOut(Console.scala:167)
  almond.internals.CaptureImpl.apply(CaptureImpl.scala:45)
  almond.Execute.capturingOutput(Execute.scala:164)
  almond.Execute.$anonfun$ammResult$8(Execute.scala:222)
  almond.Execute.$anonfun$withClientStdin$1(Execute.scala:144)
  scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
  scala.Console$.withIn(Console.scala:230)
  almond.Execute.withClientStdin(Execute.scala:140)
  almond.Execute.$anonfun$ammResult$7(Execute.scala:222)
  almond.Execute.withInputManager(Execute.scala:132)
  almond.Execute.$anonfun$ammResult$6(Execute.scala:221)
  ammonite.repl.Signaller.apply(Signaller.scala:28)
  almond.Execute.interruptible(Execute.scala:181)
  almond.Execute.$anonfun$ammResult$5(Execute.scala:220)
  ammonite.util.Res$Success.flatMap(Res.scala:62)
  almond.Execute.$anonfun$ammResult$1(Execute.scala:211)
  almond.Execute.withOutputHandler(Execute.scala:155)
  almond.Execute.ammResult(Execute.scala:211)
  almond.Execute.apply(Execute.scala:295)
  almond.ScalaInterpreter.execute(ScalaInterpreter.scala:117)
  almond.interpreter.InterpreterToIOInterpreter.$anonfun$execute$2(InterpreterToIOInterpreter.scala:69)
  cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:87)
  cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
  cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
  cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
  cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  java.lang.Thread.run(Thread.java:748)
import$ivy.`org.vegas viz:vegas_2.11:0.3.11`
导入$ivy.`org.vegas viz:vegas-spark_2.11:0.3.11`
导入$ivy.`org.apache.spark::sparksql:2.4.0`
进口$ivy.`sh.almond::almond spark:0.10.6`
导入org.apache.spark.sql_
导入org.apache.spark.sql.types
瓦尔火花={
NotebookSparkSession.builder()
.master(“本地[*]”)
.getOrCreate()
}
val intDF=spark.read.option(“header”、“true”).csv(“customer_interactions.csv”)
进口维加斯_
导入vegas.render.WindowRenderer_
导入vegas.sparkExt_
val plotDF=intDF.groupBy(“报价”).count
plotDF.schema
res11:types.StructType=StructType(
StructField(“offer”、StringType、true、{}),
StructField(“count”,LongType,false,{})
)
拉斯维加斯(“报价计数”)
.withDataFrame(plotDF)
.encodeX(“要约”,序数)
.encodeY(“计数”,定量)
.马克(巴)
显示
**用户代码中执行异常时出错(scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;)
java.lang.NoSuchMethodError:*scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
vegas.sparkExt.package$VegasSpark.withDataFrame(package.scala:16)
菊石.$sess.cmd35$Helper.(cmd35.sc:2)
菊石。$sess.cmd35$(cmd35.sc:7)
菊石$sess.cmd35$(cmd35.sc)
菊石.$sess.cmd35.$main(cmd35.sc)
sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)
invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
ammonite.runtime.Evaluator$$anon$1.$anonfun$evalMain$1(Evaluator.scala:108)
ammonite.util.util$.withContextClassloader(util.scala:24)
ammonite.runtime.Evaluator$$anon$1.evalMain(Evaluator.scala:90)
ammonite.runtime.Evaluator$$anon$1.$anonfun$processLine$2(Evaluator.scala:127)
ammonite.util.Catching.map(Res.scala:117)
ammonite.runtime.Evaluator$$anon$1.$anonfun$processLine$1(Evaluator.scala:121)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.runtime.Evaluator$$anon$1.processLine(Evaluator.scala:120)
ammonite.interp.translator.$anonfun$evaluateLine$4(translator.scala:296)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.interp.translator.$anonfun$evaluateLine$2(translator.scala:282)
ammonite.util.Catching.flatMap(Res.scala:115)
ammonite.interp.Translator.evaluateLine(Translator.scala:281)
ammonite.interp.translator.$anonfun$processLine$6(translator.scala:268)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.interp.translator.$anonfun$processLine$4(translator.scala:252)
ammonite.util.Res$Success.flatMap(Res.scala:62)
ammonite.interp.translator.$anonfun$processLine$2(translator.scala:245)
ammonite.util.Catching.flatMap(Res.scala:115)
ammonite.interp.translator.processLine(translator.scala:244)
almond.Execute.$anonfun$ammResult$9(Execute.scala:226)
almond.Internal.CaptureImpl.$anonfun$apply$2(CaptureImpl.scala:53)
scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
scala.Console$.withErr(Console.scala:196)
almond.Internal.CaptureImpl.$anonfun$apply$1(CaptureImpl.scala:45)
scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
scala.Console$.withOut(Console.scala:167)
almond.内部构件.CaptureImpl.应用(CaptureImpl.scala:45)
ammond.Execute.capturingOutput(Execute.scala:164)
almond.Execute.$anonfun$ammResult$8(Execute.scala:222)
almond.Execute.$anonfun$,其中clientstdin$1(Execute.scala:144)
scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
scala.Console$.withIn(Console.scala:230)
ammond.Execute.withClientStdin(Execute.scala:140)
almond.Execute.$anonfun$ammsult$7(Execute.scala:222)
ammond.Execute.withInputManager(Execute.scala:132)
almond.Execute.$anonfun$ammsult$6(Execute.scala:221)
ammonite.repl.Signaller.apply(Signaller.scala:28)
almond.Execute.interruptable(Execute.scala:181)
almond.Execute.$anonfun$ammsult$5(Execute.scala:220)
ammonite.util.Res$Success.flatMap(Res.scala:62)
almond.Execute.$anonfun$ammResult$1(Execute.scala:211)
ammond.Execute.withoutputhHandler(Execute.scala:155)
ammResult(Execute.scala:211)
almond.Execute.apply(Execute.scala:295)
almond.ScalaInterpreter.execute(ScalaInterpreter.scala:117)
ammond.translator.translatorToIOTranslator.$anonfun$execute$2(translatorToIOTranslator.scala:69)
cats.effect.internal.iorunoop$.cats$effect$internals$iorunoop$$循环(iorunoop.scala:87)
cats.effect.internal.iorunlop$RestartCallback.signal(iorunlop.scala:355)
cats.effect.internal.iorunlop$RestartCallback.apply(iorunlop.scala:376)
cats.effect.internal.iorunlop$RestartCallback.apply(iorunlop.scala:316)
cats.effect.internal.IOShift$Tick.run(IOShift.scala:36)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
run(Thread.java:748)