Clojure and HBase: Iterate Lazily over a Scan
问题 Lets say I want to print the output of an hbase table scan in clojure. (defmulti scan (fn [table & args] (map class args))) (defmethod scan [java.lang.String java.lang.String] [table start-key end-key] (let [scan (Scan. (Bytes/toBytes start-key) (Bytes/toBytes end-key))] (let [scanner (.getScanner table scan)] (doseq [result scanner] (prn (Bytes/toString (.getRow result)) (get-to-map result)))))) where get-to-map turns the result into a map. It could be run like this: (hbase.table/scan table