Skip to content

Instantly share code, notes, and snippets.

@nipra
Created October 31, 2012 17:39
Show Gist options
  • Select an option

  • Save nipra/3988569 to your computer and use it in GitHub Desktop.

Select an option

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

nipra commented Oct 31, 2012

Copy link
Copy Markdown
Author

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