hazelcast 3.6.1을 사용하고 맞춤형 mapreduce를 사용하여 고유 한 집계 기능을 구현하여 solr 패싯 유형의 결과를 얻습니다.Custom Dstinct Mapper의 NullPointerException
public class DistinctMapper implements Mapper<String, Employee, String, Long>{
private transient SimpleEntry<String, Employee> entry = new SimpleEntry<String, Employee>();
private static final Long ONE = Long.valueOf(1L);
private Supplier<String, Employee, String> supplier;
public DistinctMapper(Supplier<String, Employee, String> supplier) {
this.supplier = supplier;
}
@Override
public void map(String key, Employee value, Context<String, Long> context) {
System.out.println("Object "+ entry + " and key "+key);
entry.setKey(key);
entry.setValue(value);
String fieldValue = (String) supplier.apply(entry);
//getValue(value, fieldName);
if (null != fieldValue){
context.emit(fieldValue, ONE);
}
}
}
mapper가 NullPointerException으로 실패합니다. 그리고 sysout 명령문은 입력 오브젝트가 널임을 나타냅니다.
당신이 날 위의 코드에서 문제를 지적 할 수 있습니까? 감사.
hazelcast의 매퍼 코드에서 일시적인 효과가 있습니까? –