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();
}
}
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);
}
}
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);
}
}
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);
}
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);
}
Aggregations