println

Spark losing println() on stdout

假如想象 提交于 2019-11-26 06:44:57
问题 I have the following 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\") Then the blueCount is not zero, but I got no println() output! Am I missing anything here? Thanks! 回答1: This is a conceptual question... Imagine You have a big cluster,

Division of integers in Java [duplicate]

99封情书 提交于 2019-11-25 22:13:33
问题 This question already has an answer here: Int division: Why is the result of 1/3 == 0? 15 answers This is a basic question but I can\'t find an answer. I\'ve looked into floating point arithmetic and a few other topics but nothing has seemed to address this. I\'m sure I just have the wrong terminology. Basically, I want to take two quantities - completed, and total - and divide them to come up with a percentage (of how much has been completed). The quantities are long s. Here\'s the setup: