Search in sources :

Example 1 with DoubleSerializerDeserializer

use of org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer in project asterixdb by apache.

the class LSMRTreeMergeTestDriver method runTest.

@Override
protected void runTest(ISerializerDeserializer[] fieldSerdes, IPrimitiveValueProviderFactory[] valueProviderFactories, int numKeys, ITupleReference key, RTreePolicyType rtreePolicyType) throws Exception {
    AbstractRTreeTestContext ctx = createTestContext(fieldSerdes, valueProviderFactories, numKeys, rtreePolicyType);
    ctx.getIndex().create();
    ctx.getIndex().activate();
    // to determine which field types to generate.
    if (fieldSerdes[0] instanceof IntegerSerializerDeserializer) {
        rTreeTestUtils.bulkLoadIntTuples(ctx, numTuplesToInsert, getRandom());
    } else if (fieldSerdes[0] instanceof DoubleSerializerDeserializer) {
        rTreeTestUtils.bulkLoadDoubleTuples(ctx, numTuplesToInsert, getRandom());
    }
    int maxTreesToMerge = AccessMethodTestsConfig.LSM_RTREE_BULKLOAD_ROUNDS;
    for (int i = 0; i < maxTreesToMerge; i++) {
        for (int j = 0; j < i; j++) {
            if (fieldSerdes[0] instanceof IntegerSerializerDeserializer) {
                rTreeTestUtils.insertIntTuples(ctx, numTuplesToInsert, getRandom());
                // Deactivate and the re-activate the index to force it flush its in memory component
                ctx.getIndex().deactivate();
                ctx.getIndex().activate();
            } else if (fieldSerdes[0] instanceof DoubleSerializerDeserializer) {
                rTreeTestUtils.insertDoubleTuples(ctx, numTuplesToInsert, getRandom());
                // Deactivate and the re-activate the index to force it flush its in memory component
                ctx.getIndex().deactivate();
                ctx.getIndex().activate();
            }
        }
        ILSMIndexAccessor accessor = (ILSMIndexAccessor) ctx.getIndexAccessor();
        accessor.scheduleMerge(NoOpIOOperationCallbackFactory.INSTANCE.createIoOpCallback(), ((AbstractLSMRTree) ctx.getIndex()).getImmutableComponents());
        rTreeTestUtils.checkScan(ctx);
        rTreeTestUtils.checkDiskOrderScan(ctx);
        rTreeTestUtils.checkRangeSearch(ctx, key);
    }
    ctx.getIndex().deactivate();
    ctx.getIndex().destroy();
}
Also used : IntegerSerializerDeserializer(org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer) DoubleSerializerDeserializer(org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer) AbstractRTreeTestContext(org.apache.hyracks.storage.am.rtree.AbstractRTreeTestContext) ILSMIndexAccessor(org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor)

Aggregations

DoubleSerializerDeserializer (org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer)1 IntegerSerializerDeserializer (org.apache.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer)1 ILSMIndexAccessor (org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor)1 AbstractRTreeTestContext (org.apache.hyracks.storage.am.rtree.AbstractRTreeTestContext)1