私はhazelcast 3.6.1を使用しており、カスタムmapreduceを使用して個別の集計機能を実装して、solrファセットの種類の結果を取得しています。
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);
}
}
}
マッパーは NullPointerException で失敗しています。およびsysoutステートメントは、エントリオブジェクトがnullであることを示しています。
上記のコードの問題点を教えていただけますか? ありがとう。