ClojureでSpark Structured Streamingの例を書き直そうとしています。次のようにClojureでSpark Structured Streamingの例を書き込むときのエラー
例はScalaで書かれている:
https://spark.apache.org/docs/latest/structured-streaming-programming-guide.html
(ns flambo-example.streaming-example
(:import [org.apache.spark.sql Encoders SparkSession Dataset Row]
[org.apache.spark.sql.functions]
))
(def spark
(->
(SparkSession/builder)
(.appName "sample")
(.master "local[*]")
.getOrCreate)
)
(def lines
(-> spark
.readStream
(.format "socket")
(.option "host" "localhost")
(.option "port" 9999)
.load
)
)
(def words
(-> lines
(.as (Encoders/STRING))
(.flatMap #(clojure.string/split % #" "))
))
上記のコードは、次の例外を引き起こします。
;; java.lang.IllegalArgumentExceptionによって引き起こされる ;;一致するメソッドが見つかりません:クラス ;のflatMap org.apache.spark.sql.Dataset
どうすればこのエラーを回避できますか?