Search in sources :

Example 46 with ITupleReference

use of org.apache.hyracks.dataflow.common.data.accessors.ITupleReference 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 47 with ITupleReference

use of org.apache.hyracks.dataflow.common.data.accessors.ITupleReference in project asterixdb by apache.

the class TreeIndexTestUtils method addFilterField.

protected void addFilterField(IIndexTestContext ctx, MutablePair<ITupleReference, ITupleReference> minMax) throws HyracksDataException {
    //Duplicate the PK field as a filter field at the end of the tuple to be inserted.
    int filterField = ctx.getFieldCount();
    ITupleReference currTuple = ctx.getTuple();
    ArrayTupleBuilder filterBuilder = new ArrayTupleBuilder(1);
    filterBuilder.addField(currTuple.getFieldData(filterField), currTuple.getFieldStart(filterField), currTuple.getFieldLength(filterField));
    IBinaryComparator comparator = ctx.getComparatorFactories()[0].createBinaryComparator();
    ArrayTupleReference filterOnlyTuple = new ArrayTupleReference();
    filterOnlyTuple.reset(filterBuilder.getFieldEndOffsets(), filterBuilder.getByteArray());
    if (minMax == null) {
        minMax = MutablePair.of(filterOnlyTuple, filterOnlyTuple);
    } else if (compareFilterTuples(minMax.getLeft(), filterOnlyTuple, comparator) > 0) {
        minMax.setLeft(filterOnlyTuple);
    } else if (compareFilterTuples(minMax.getRight(), filterOnlyTuple, comparator) < 0) {
        minMax.setRight(filterOnlyTuple);
    }
}
Also used : ArrayTupleReference(org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ArrayTupleBuilder(org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)

Example 48 with ITupleReference

use of org.apache.hyracks.dataflow.common.data.accessors.ITupleReference in project asterixdb by apache.

the class OrderedIndexTestDriver method twoStringKeysAndValues.

@Test
public void twoStringKeysAndValues() throws Exception {
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("BTree " + getTestOpName() + " Test With Two String Keys And Values.");
    }
    ISerializerDeserializer[] fieldSerdes = { new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer(), new UTF8StringSerializerDeserializer() };
    // Range search in ["cbf", "ddd", cc7", "eee"]
    ITupleReference lowKey = TupleUtils.createTuple(fieldSerdes, "cbf", "ddd");
    ITupleReference highKey = TupleUtils.createTuple(fieldSerdes, "cc7", "eee");
    // Prefix range search in ["cbf", cc7"]
    ITupleReference prefixLowKey = TupleUtils.createTuple(fieldSerdes, "cbf");
    ITupleReference prefixHighKey = TupleUtils.createTuple(fieldSerdes, "cc7");
    for (BTreeLeafFrameType leafFrameType : leafFrameTypesToTest) {
        runTest(fieldSerdes, 2, leafFrameType, lowKey, highKey, prefixLowKey, prefixHighKey);
    }
}
Also used : ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) UTF8StringSerializerDeserializer(org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer) ISerializerDeserializer(org.apache.hyracks.api.dataflow.value.ISerializerDeserializer) BTreeLeafFrameType(org.apache.hyracks.storage.am.btree.frames.BTreeLeafFrameType) Test(org.junit.Test)

Example 49 with ITupleReference

use of org.apache.hyracks.dataflow.common.data.accessors.ITupleReference in project asterixdb by apache.

the class AbstractRTreeTestDriver method rstartreeFourDimensionsDouble.

@Test
public void rstartreeFourDimensionsDouble() throws Exception {
    if (!testRstarPolicy) {
        if (LOGGER.isLoggable(Level.INFO)) {
            LOGGER.info("Ignoring RTree " + getTestOpName() + " Test With Four Dimensions With Double Keys.");
        }
        return;
    }
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("RTree " + getTestOpName() + " Test With Four Dimensions With Double Keys.");
    }
    ISerializerDeserializer[] fieldSerdes = { DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE };
    int numKeys = 8;
    IPrimitiveValueProviderFactory[] valueProviderFactories = RTreeUtils.createPrimitiveValueProviderFactories(numKeys, DoublePointable.FACTORY);
    // Range search, the rectangle bottom left coordinates are -1000.0,
    // -1000.0, -1000.0, -1000.0 and the top right coordinates are 1000.0,
    // 1000.0, 1000.0, 1000.0
    ITupleReference key = TupleUtils.createDoubleTuple(-1000.0, -1000.0, -1000.0, -1000.0, 1000.0, 1000.0, 1000.0, 1000.0);
    runTest(fieldSerdes, valueProviderFactories, numKeys, key, RTreePolicyType.RSTARTREE);
}
Also used : IPrimitiveValueProviderFactory(org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ISerializerDeserializer(org.apache.hyracks.api.dataflow.value.ISerializerDeserializer) Test(org.junit.Test)

Example 50 with ITupleReference

use of org.apache.hyracks.dataflow.common.data.accessors.ITupleReference in project asterixdb by apache.

the class AbstractRTreeTestDriver method rtreeTwoDimensionsDouble.

@Test
public void rtreeTwoDimensionsDouble() throws Exception {
    if (LOGGER.isLoggable(Level.INFO)) {
        LOGGER.info("RTree " + getTestOpName() + " Test With Two Dimensions With Double Keys.");
    }
    ISerializerDeserializer[] fieldSerdes = { DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE, DoubleSerializerDeserializer.INSTANCE };
    int numKeys = 4;
    IPrimitiveValueProviderFactory[] valueProviderFactories = RTreeUtils.createPrimitiveValueProviderFactories(numKeys, DoublePointable.FACTORY);
    // Range search, the rectangle bottom left coordinates are -1000.0,
    // -1000.0 and the top right coordinates are 1000.0, 1000.0
    ITupleReference key = TupleUtils.createDoubleTuple(-1000.0, -1000.0, 1000.0, 1000.0);
    runTest(fieldSerdes, valueProviderFactories, numKeys, key, RTreePolicyType.RTREE);
}
Also used : IPrimitiveValueProviderFactory(org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory) ITupleReference(org.apache.hyracks.dataflow.common.data.accessors.ITupleReference) ISerializerDeserializer(org.apache.hyracks.api.dataflow.value.ISerializerDeserializer) Test(org.junit.Test)

Aggregations

ITupleReference (org.apache.hyracks.dataflow.common.data.accessors.ITupleReference)149 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)80 ArrayList (java.util.ArrayList)40 ACIDException (org.apache.asterix.common.exceptions.ACIDException)31 MetadataEntityValueExtractor (org.apache.asterix.metadata.valueextractors.MetadataEntityValueExtractor)26 ISerializerDeserializer (org.apache.hyracks.api.dataflow.value.ISerializerDeserializer)20 Test (org.junit.Test)20 RangePredicate (org.apache.hyracks.storage.am.btree.impls.RangePredicate)18 IIndexCursor (org.apache.hyracks.storage.common.IIndexCursor)18 Dataset (org.apache.asterix.metadata.entities.Dataset)10 MultiComparator (org.apache.hyracks.storage.common.MultiComparator)10 CheckTuple (org.apache.hyracks.storage.am.common.CheckTuple)8 ITreeIndexAccessor (org.apache.hyracks.storage.am.common.api.ITreeIndexAccessor)8 ITreeIndexCursor (org.apache.hyracks.storage.am.common.api.ITreeIndexCursor)8 ArrayTupleBuilder (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)7 ILSMDiskComponentBulkLoader (org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponentBulkLoader)7 SearchPredicate (org.apache.hyracks.storage.am.rtree.impls.SearchPredicate)7 ExtensionMetadataDataset (org.apache.asterix.metadata.api.ExtensionMetadataDataset)6 Datatype (org.apache.asterix.metadata.entities.Datatype)6 ArrayTupleReference (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference)6