Created
May 7, 2010 06:35
-
-
Save zznate/393142 to your computer and use it in GitHub Desktop.
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
Given Keyspace ks, and an optional startOnKey string, the following snippet returns a Set of 100 keys without de-serializing the underlying columns. The tradeoff is that you have no local check on tombstones. Pass the last key retrieved as startOnKey to page. | |
ColumnParent clp = new ColumnParent(columnFamilyName); | |
SlicePredicate sp = new SlicePredicate(); | |
sp.setColumn_names(new ArrayList<byte[]>()); | |
KeyRange keyRange = new KeyRange(); | |
keyRange.setCount(100); | |
if ( StringUtils.isBlank(startOnKey)) { | |
keyRange.setStart_key(""); | |
} else { | |
keyRange.setStart_key(startOnKey); | |
} | |
keyRange.setEnd_key(""); | |
return ks.getRangeSlices(clp, sp, keyRange).keySet(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment