0

私は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であることを示しています。

SimpleEntry : https://github.com/hazelcast/hazelcast/blob/v3.7-EA/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/impl/SimpleEntry.java

上記のコードの問題点を教えていただけますか? ありがとう。

4

1 に答える 1