[Solved] Spark Streaming:updateStateByKey is not applicable for the arguments…

ones.updateStateByKey(new Function2<List<Integer>, Optional<Integer>, Optional<Integer>>() {
            public Optional<Integer> call(List<Integer> arg0, Optional<Integer> arg1) throws Exception {
                // TODO Auto-generated method stub
                return null;

JavaPairDStream<String, Integer> ones use updateStateByKey error:

The method updateStateByKey(Function2<List<Integer>,Optional<S>,Optional<S>>) in the type JavaPairDStream<String,Integer> is not applicable for the arguments (new Function2<List<Integer>,Optional<Integer>,Optional<Integer>>(){})

Solution: It is likely that the Optional package was misdirected, to direct com.google.common.base.Optional


Similar Posts: