use of site.ycsb.db.voltdb.sortedvolttable.VoltDBTableSortedMergeWrangler in project YCSB by brianfrankcooper.
the class VoltClient4 method scan.
@Override
public Status scan(String keyspace, String lowerBound, int recordCount, Set<String> columns, Vector<HashMap<String, ByteIterator>> result) {
try {
if (useScanAll) {
byte[] ks = keyspace.getBytes(UTF8);
ClientResponse response = mclient.callProcedure("ScanAll", ks, lowerBound.getBytes(UTF8), recordCount);
if (response.getStatus() != ClientResponse.SUCCESS) {
return Status.ERROR;
}
result.ensureCapacity(recordCount);
VoltTable outputTable = response.getResults()[0];
outputTable.resetRowPosition();
while (outputTable.advanceRow()) {
result.add(unpackRowDataHashMap(outputTable, columns));
}
} else {
byte[] ks = keyspace.getBytes(UTF8);
ClientResponseWithPartitionKey[] response = mclient.callAllPartitionProcedure("Scan", ks, lowerBound.getBytes(UTF8), recordCount);
for (int i = 0; i < response.length; i++) {
if (response[i].response.getStatus() != ClientResponse.SUCCESS) {
return Status.ERROR;
}
}
result.ensureCapacity(recordCount);
VoltDBTableSortedMergeWrangler smw = new VoltDBTableSortedMergeWrangler(response);
VoltTable outputTable = smw.getSortedTable(1, recordCount);
outputTable.resetRowPosition();
while (outputTable.advanceRow()) {
result.add(unpackRowDataHashMap(outputTable, columns));
}
}
return Status.OK;
} catch (Exception e) {
logger.error("Error while calling SCAN", e);
return Status.ERROR;
}
}
Aggregations