当前位置:   article > 正文

java.lang.NumberFormatException: For input string: ““ org.apache.spark.SparkException: : Task[scala]_spark报错caused by: java.lang.numberformatexception:

spark报错caused by: java.lang.numberformatexception: for input string:

User class threw exception: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 14.0 failed 4 times, most recent failure: Lost task 0.3 in stage 14.0 (TID 390, 9.54.136.125, executor 9): java.lang.NumberFormatException: For input string: "5326795854138346"

使用Scala语言报错,从网上找的资料可以知道,Int类型最长到10位数,而我输入的"5326795854138346",远多于十位数,这时将他转成Int类型就报错,

 

可以这么改:

val data1 = data.map(_.toString.toLong)

一般要先转换成string类型 再转换

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/474630
推荐阅读
相关标签
  

闽ICP备14008679号