简体   繁体   English

Scala代码可在Spark Terminal上运行,但不能在Eclipse中运行

[英]Scala code works on Spark Terminal but not in eclipse

The code below works fine when I run it on Spark Terminal but in eclipse it throws an error. 当我在Spark Terminal上运行以下代码时,该代码运行良好,但是在eclipse中,它将引发错误。 What might be the reason. 可能是什么原因。 Please let me know if you need more information. 如果您需要更多信息,请告诉我。

val IABLabels= IAB.zip(labels) val IABLabels = IAB.zip(标签)
val temp1 = IABLabels.groupBy(x=>x._2).mapValues( _.map( _._1 )) val temp1 = IABLabels.groupBy(x => x._2).mapValues(_.map(_._ 1))

Error in Eclipse: Eclipse中的错误:
value mapValues is not a member of org.apache.spark.rdd.RDD[(Int, Iterable[(String, Int)])] 值mapValues不是org.apache.spark.rdd.RDD [(Int,Iterable [(String,Int)])]的成员

The code runs perfectly fine on Spark shell. 该代码在Spark Shell上运行良好。

You should use this import to access extra functions on RDD's of (key,value) pairs through an implicit conversion: 您应该使用此导入,通过隐式转换访问(键,值)对的RDD上的其他功能:

import org.apache.spark.SparkContext._

You can check the API docs for further details. 您可以查看API文档以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM