我在群集上运行spark作业时遇到以下匹配错误。我认为它是scala的通用。
15/05/27 00:33:45 INFO scheduler.TaskSetManager: Serialized task 22.0:3 as 20587 bytes in 0 ms
15/05/27 00:33:45 WARN scheduler.TaskSetManager: Lost TID 224 (task 22.0:8)
15/05/27 00:33:45 WARN scheduler.TaskSetManager: Loss was due to scala.MatchError
scala.MatchError: -0.07129246757414678 (of class java.lang.Double)
发生的事情是:
amnt match {
case x if ( x >= 0.0 && x < 10.0) => a(0) = a(0) + 1
case x if ( x >= 10.0 && x < 20.0 ) => a(1) = a(1) + 1
case x if ( x >= 20.0 && x < 30.0 ) => a(2) = a(2)+ 1
}
我在比赛前尝试过跟进,但没有帮助 val amnt = amount.toDouble
答案 0 :(得分:0)
由于GáborBakos和vanz建议我忘记添加通用案例
case _ => "do nothing"