本文介绍了星火在stdout失去的println()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下的code:

val blueCount = sc.accumulator[Long](0)
val output = input.map { data =>
  for (value <- data.getValues()) {
    if (record.getEnum() == DataEnum.BLUE) {
      blueCount += 1
      println("Enum = BLUE : " + value.toString()
    }
  }
  data
}.persist(StorageLevel.MEMORY_ONLY_SER)

output.saveAsTextFile("myOutput")


那么blueCount不为零,但我没有得到的println()输出!我缺少什么吗?谢谢!


Then the blueCount is not zero, but I got no println() output! Am I missing anything here? Thanks!

推荐答案

我能够通过一个UtilityFunction各地工作吧:

I was able to work it around by making an UtilityFunction:

object PrintUtiltity {
    def print(data:String) = {
      println(data)
    }
}

这篇关于星火在stdout失去的println()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 21:31