Created
October 31, 2012 17:39
-
-
Save nipra/3988569 to your computer and use it in GitHub Desktop.
Count rows starting with prefix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Find the bug because of which this code is returning about half of the actual number of rows starting with prefix ``0 ''. :-)