scala> us.show
<console>:32: error: value show is not a member of org.apache.spark.rdd.RDD[(Int, String)]
us.show
答案 0 :(得分:2)
org.apache.spark.rdd.RDD[(Int, String)]
没有方法show()
您必须将数据框更改为
import spark.implicits._
us.toDF().show()
us.toDF("id", "name").show //You can provide the column name here
希望这会有所帮助!
答案 1 :(得分:1)
RDD没有显示为方法。您可以将rdd转换为数据帧或数据集。
import spark.implicits._ assuming spark is your spark session.
您可以在RDD中使用take方法
rdd.take(10).foreach(println) here it will take 10 records from rdd and will print the result.