Closed dpom closed 6 years ago
I defined an rdd with: (def occs (-> orders (keg/rdd (map read-string) (map #(comb/combinations % 2)) (mapcat identity) (map sort)) (keg/by-key :key identity :pre x/count :post (x/reduce +))))
How I call a side-effect function (write to a db) for each element of the occs (an equivalent of spark's foreach)?
See do-rdd. The binding vector is for resources management (e.g. db connection).
do-rdd
Thanks, that's exactly what I needed.
I defined an rdd with: (def occs (-> orders (keg/rdd (map read-string) (map #(comb/combinations % 2)) (mapcat identity) (map sort)) (keg/by-key :key identity :pre x/count :post (x/reduce +))))
How I call a side-effect function (write to a db) for each element of the occs (an equivalent of spark's foreach)?