Im пытается запустить своего рода алгоритм, использующий MapReduce, но всегда я получаю массив из ofBoundМассив OUTOF связан MapReduce
Exception
java.lang.ArrayIndexOutOfBoundsException: 6
at to.SecSortMapper.map(SecSortMapper.java:17)
at to.SecSortMapper.map(SecSortMapper.java:1)
код
if (value.toString().length() > 0) {
String arrEmpAttributes[] = value.toString().split("\\t");
context.write(new TextPair(arrEmpAttributes[6].toString(),
(arrEmpAttributes[3].toString() + "\t" + arrEmpAttributes[2].toString() + "\t" + arrEmpAttributes[0].toString())), nullWritable.get());
}
Line 17 это новый TextPair (.............)
Я попытался изменить строку строки значений> 1, но он не работает, может кто-нибудь помочь?
Вы также должны создать еще один чек 'если (arrEmpAttributes.length> 0)' потому что вы используете arrEmpAttributes [6] может быть его длина меньше чем 6 –
if (value.toString(). length()> 1) { Строка arrEmpAttributes [] = значение.toString(). split ("\\ t"); //System.out.printf("longeuur est ", arrEmpAttributes.length); context.write ( новые TextPair (arrEmpAttributes [6] .ToString(), (arrEmpAttributes [3] .ToString() + "\ т" + arrEmpAttributes [2] .ToString() + "\ т" + arrEmpAttributes [0] .ToString())), NullWritable.null }} здесь peusdocode я думаю, что его бесполезно, чтобы создать другой, если (aarrEmAttribute> 0} – BigBosss
жаль, если (arrEmpAttributes.length> 6) –