Search in sources :

Example 1 with TupleBatch

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;
}
Also used : IIndexBulkLoader(org.apache.hyracks.storage.common.IIndexBulkLoader) TupleBatch(org.apache.hyracks.storage.am.common.datagen.TupleBatch)

Example 2 with TupleBatch

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();
    }
}
Also used : TestOperation(org.apache.hyracks.storage.am.common.TestOperationSelector.TestOperation) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) TupleBatch(org.apache.hyracks.storage.am.common.datagen.TupleBatch)

Example 3 with TupleBatch

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;
}
Also used : TupleBatch(org.apache.hyracks.storage.am.common.datagen.TupleBatch)

Aggregations

TupleBatch (org.apache.hyracks.storage.am.common.datagen.TupleBatch)3 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)1 ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)1 TestOperation (org.apache.hyracks.storage.am.common.TestOperationSelector.TestOperation)1 IIndexBulkLoader (org.apache.hyracks.storage.common.IIndexBulkLoader)1