所以,我期待我的数据采用以下格式:
"domain::foo::127"
所以这是我的代码:
String[] typeChunks = input.split("::");
String type = typeChunks[0];
String edge = typeChunks[1];
double reputation = Double.parseDouble(typeChunks[2].trim());
但我得到了这个错误
java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1011)
at java.lang.Double.parseDouble(Double.java:540)
at org.attempt2.BuildGraph$ReduceClass.reduce(BuildGraph.java:94)
at org.attempt2.BuildGraph$ReduceClass.reduce(BuildGraph.java:1)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:176)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:650)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:418)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1136)
at org.apache.hadoop.mapred.Child.main(Child.java:249)
有什么好的方法来处理这个?