Skip to content

Instantly share code, notes, and snippets.

@nipra
Created October 31, 2012 17:39
Show Gist options
  • Save nipra/3988569 to your computer and use it in GitHub Desktop.
Save nipra/3988569 to your computer and use it in GitHub Desktop.
Count rows starting with prefix
(let [f1 (PrefixFilter. (hb/to-bytes "0 "))]
(hb/with-table [table (hb/table "foo_bar_table")]
(hb/with-scanner [scanner (hb/scan table
:filter f1
:caching 1000)]
(loop [n 0]
(if (seq (.next scanner 1000))
(recur (+ n (count (.next scanner 1000))))
n)))))
@nipra
Copy link
Author

nipra commented Oct 31, 2012

Find the bug because of which this code is returning about half of the actual number of rows starting with prefix ``0 ''. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment