Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Primary key cursor for CQL3

  • Loading branch information...
commit b90380fbf76a60b9b83b4e57bdb1e974746a9a0e 1 parent a605c36
@easility easility authored
View
2  build.gradle
@@ -26,6 +26,7 @@ dependencies {
provided (group: 'com.netflix.astyanax', name: 'astyanax', version: '1.56.42') {
exclude group: 'org.slf4j'
exclude group: 'log4j'
+ exclude group: 'org.jboss.netty'
}
compile (group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '1.0.2') {
exclude group: 'org.slf4j'
@@ -49,6 +50,7 @@ dependencies {
exclude group: 'org.apache.maven.scm'
exclude group: 'org.slf4j'
exclude group: 'log4j'
+ exclude group: 'org.jboss.netty'
}
provided (group: 'org.apache.hadoop', name: 'hadoop-core', version: '1.0.4')
compile 'org.antlr:antlr-runtime:3.2'
View
22 src/main/java/com/alvazan/orm/layer9z/spi/db/cassandracql3/CursorKeysToRowsCql3.java
@@ -1,5 +1,6 @@
package com.alvazan.orm.layer9z.spi.db.cassandracql3;
+import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -129,34 +130,24 @@ private void loadCache() {
return;
*/
ResultSet resultSet = null;
- System.out.println("HERE 00 " + keysToLookup.size());
if (keysToLookup.size() > 0) {
- System.out.println("HERE 11");
String[] keyStrings = new String[keysToLookup.size()];
int count = 0;
for (byte[] rowKey : keysToLookup) {
keyStrings[count] = StandardConverters.convertFromBytes(String.class, rowKey);
count++;
}
- System.out.println("COUNT " +count);
+
if (list != null)
list.beforeFetchingNextBatch();
try {
Clause inClause = QueryBuilder.in("id", keyStrings);
Query query = QueryBuilder.select().all().from(keys, cf.getColumnFamily()).where(inClause).limit(batchSize);
- //PreparedStatement statement = session.prepare("SELECT * FROM" + keys + "." + cf.getColumnFamily() + "WHERE IN (?, ?, ?)");
- //BoundStatement boundStatement = new BoundStatement(statement);
resultSet = session.execute(query);
- System.out.println(" results:" + resultSet);
} catch (Exception e) {
System.out.println(" Exception:" + e.getMessage());
}
-/* BasicDBObject query = new BasicDBObject();
- query.put("_id", new BasicDBObject("$in", keysToLookup));
- BasicDBObject orderBy = new BasicDBObject();
- orderBy.put("_id", 1);
- cursor = dbCollection.find(query).sort(orderBy).batchSize(batchSize);*/
/* if (list != null)
list.afterFetchingNextBatch(cursor.count());*/
}
@@ -276,9 +267,7 @@ private void fillCache(Map<ByteArray, KeyValue<Row>> map, ResultSet cursor,
for (com.datastax.driver.core.Row cqlRow : cursor) {
String rowKey1 = cqlRow.getString("id");
- System.out.println("rowKey1 " + rowKey1);
if (rowKey1.equals(rowKey)) {
- System.out.println("SAME ROW");
actualRowList.add(cqlRow);
} else {
if (rowKey != null)
@@ -289,8 +278,6 @@ private void fillCache(Map<ByteArray, KeyValue<Row>> map, ResultSet cursor,
}
}
cqlRows.add(actualRowList);
- System.out.println("cqlRows size: " + cqlRows.size());
- System.out.println("actualRowList size: " + actualRowList.size());
for (List<com.datastax.driver.core.Row> actualRow : cqlRows) {
KeyValue<Row> kv = new KeyValue<Row>();
Row r = rowProvider.get();
@@ -300,9 +287,10 @@ private void fillCache(Map<ByteArray, KeyValue<Row>> map, ResultSet cursor,
kv.setKey(cqlRowKey);
r.setKey(cqlRowKey);
byte[] name = StandardConverters.convertToBytes(cqlRow.getString("colname"));
- byte[] val = cqlRow.getBytesUnsafe("colvalue").array();
+ ByteBuffer data = cqlRow.getBytes("colvalue");
+ byte[] val = new byte[data.remaining()];
+ data.get(val);
String strValue = StandardConverters.convertFromBytes(String.class, val);
- System.out.println("STRVALUE " + strValue);
Column c = new Column();
c.setName(name);
if (!strValue.equals("_n"))
Please sign in to comment.
Something went wrong with that request. Please try again.