Spark Streaming:updateStateByKey報錯 is not applicable for the arguments...


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

對JavaPairDStream<String, Integer> ones使用updateStateByKey報錯:

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>>(){})

 

解決辦法:很可能是Optional導包導錯了,要導com.google.common.base.Optional


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM