Permalink
Browse files

SliceRange changed in 0.6 - fixed CassandraClient.java

  • Loading branch information...
1 parent 3355a6f commit 8659cc2fb1115aba3d4b5f1db00ae0fa8a335e4a @brianfrankcooper brianfrankcooper committed Apr 20, 2010
Showing with 553 additions and 41 deletions.
  1. +53 −41 src/com/yahoo/ycsb/db/CassandraClient.java
  2. +500 −0 src/com/yahoo/ycsb/db/CassandraClient5.java
@@ -138,46 +138,54 @@ public int read(String table, String key, Set<String> fields, HashMap<String,Str
try
{
-
- SlicePredicate predicate;
- if (fields==null)
- {
- predicate = new SlicePredicate(null,new SliceRange(new byte[0], new byte[0],false,1000000));
- }
- else
- {
- Vector<byte[]> fieldlist=new Vector<byte[]>();
- for (String s : fields)
- {
- fieldlist.add(s.getBytes("UTF-8"));
- }
- predicate = new SlicePredicate(fieldlist,null);
- }
- ColumnParent parent = new ColumnParent("data", null);
- List<ColumnOrSuperColumn> results = client.get_slice(table, key, parent, predicate, ConsistencyLevel.ONE);
-
- if (_debug)
- {
- System.out.print("READ: ");
- }
-
- for (ColumnOrSuperColumn oneresult : results)
- {
- Column column=oneresult.column;
- result.put(new String(column.name),new String(column.value));
-
- if (_debug)
- {
- System.out.print("("+new String(column.name)+"="+new String(column.value)+")");
- }
- }
-
- if (_debug)
- {
- System.out.println("");
- }
-
- return Ok;
+
+ SlicePredicate predicate;
+ if (fields==null)
+ {
+
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ sliceRange.setCount(1000000);
+
+ //predicate = new SlicePredicate(null,new SliceRange(new byte[0], new byte[0],false,1000000));
+ predicate = new SlicePredicate(null,sliceRange);
+ //predicate.setSlice_range(sliceRange);
+ }
+ else
+ {
+ Vector<byte[]> fieldlist=new Vector<byte[]>();
+ for (String s : fields)
+ {
+ fieldlist.add(s.getBytes("UTF-8"));
+ }
+ predicate = new SlicePredicate(fieldlist,null);
+ }
+ ColumnParent parent = new ColumnParent("data", null);
+ List<ColumnOrSuperColumn> results = client.get_slice(table, key, parent, predicate, ConsistencyLevel.ONE);
+
+ if (_debug)
+ {
+ System.out.print("READ: ");
+ }
+
+ for (ColumnOrSuperColumn oneresult : results)
+ {
+ Column column=oneresult.column;
+ result.put(new String(column.name),new String(column.value));
+
+ if (_debug)
+ {
+ System.out.print("("+new String(column.name)+"="+new String(column.value)+")");
+ }
+ }
+
+ if (_debug)
+ {
+ System.out.println("");
+ }
+
+ return Ok;
}
catch (Exception e)
{
@@ -220,7 +228,11 @@ public int scan(String table, String startkey, int recordcount, Set<String> fiel
SlicePredicate predicate;
if (fields==null)
{
- predicate = new SlicePredicate(null,new SliceRange(new byte[0], new byte[0],false,1000000));
+ SliceRange sliceRange = new SliceRange();
+ sliceRange.setStart(new byte[0]);
+ sliceRange.setFinish(new byte[0]);
+ sliceRange.setCount(1000000);
+ predicate = new SlicePredicate(null,sliceRange);
}
else
{
Oops, something went wrong.

0 comments on commit 8659cc2

Please sign in to comment.