我有我的星火流應用程序下面的行編譯罰款:爲什麼Scala編譯器會因「無法解析帶有這種簽名的引用reduceByKeyAndWindow」而失敗?
val kafkaDirectStream: InputDStream[ConsumerRecord[String,String]] = KafkaUtils.createDirectStream(...)
kafkaDirectStream.map(_ => ("mockkey", 1)).reduceByKeyAndWindow(_+_, Seconds(30))
當我使用的reduceByKeyAndWindow
變異有兩個Duration
S作爲如下:
.reduceByKeyAndWindow(_ + _, Seconds(30), Seconds(10))
我面對的下方編譯器錯誤:
Cannot resolve reference reduceByKeyAndWindow with such signature
爲什麼?