use of org.apache.hyracks.storage.am.common.datagen.TupleBatch in project asterixdb by apache.
the class BTreeBulkLoadRunner method runExperiment.
@Override
public long runExperiment(DataGenThread dataGen, int numThreads) throws Exception {
btree.create();
long start = System.currentTimeMillis();
IIndexBulkLoader bulkLoader = btree.createBulkLoader(1.0f, false, 0L, true);
for (int i = 0; i < numBatches; i++) {
TupleBatch batch = dataGen.tupleBatchQueue.take();
for (int j = 0; j < batch.size(); j++) {
bulkLoader.add(batch.get(j));
}
}
bulkLoader.end();
long end = System.currentTimeMillis();
long time = end - start;
return time;
}
use of org.apache.hyracks.storage.am.common.datagen.TupleBatch in project asterixdb by apache.
the class AbstractIndexTestWorker method run.
@Override
public void run() {
try {
for (int i = 0; i < numBatches; i++) {
TupleBatch batch = dataGen.getBatch();
for (int j = 0; j < batch.size(); j++) {
TestOperation op = opSelector.getOp(rnd.nextInt());
ITupleReference tuple = batch.get(j);
performOp(tuple, op);
}
dataGen.releaseBatch(batch);
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.apache.hyracks.storage.am.common.datagen.TupleBatch in project asterixdb by apache.
the class InMemorySortRunner method runExperiment.
@Override
public long runExperiment(DataGenThread dataGen, int numThreads) throws InterruptedException {
// Wait until the tupleBatchQueue is completely full.
while (dataGen.tupleBatchQueue.remainingCapacity() != 0) {
Thread.sleep(10);
}
long start = System.currentTimeMillis();
int tupleIndex = 0;
for (int i = 0; i < numBatches; i++) {
TupleBatch batch = dataGen.tupleBatchQueue.take();
for (int j = 0; j < batch.size(); j++) {
// Copy the tuple to the buffer and set the pre-created tuple ref.
tupleWriter.writeTuple(batch.get(j), tupleBuf.array(), tupleIndex * tupleSize);
tuples.get(tupleIndex).resetByTupleOffset(tupleBuf.array(), tupleIndex * tupleSize);
tupleIndex++;
}
}
// Perform the sort.
Collections.sort(tuples, tupleCmp);
long end = System.currentTimeMillis();
long time = end - start;
return time;
}
Aggregations