Search in sources :

Example 1 with AbstractSortRunGenerator

use of org.apache.hyracks.dataflow.std.sort.AbstractSortRunGenerator in project asterixdb by apache.

the class TopKRunGeneratorTest method testHybridTopKShouldSwitchToFrameSorterWhenFlushed.

@Test
public void testHybridTopKShouldSwitchToFrameSorterWhenFlushed() {
    int topK = 1;
    IHyracksTaskContext ctx = AbstractRunGeneratorTest.testUtils.create(PAGE_SIZE);
    AbstractSortRunGenerator sorter = new HybridTopKSortRunGenerator(ctx, SORT_FRAME_LIMIT, topK, SortFields, null, ComparatorFactories, RecordDesc);
}
Also used : IHyracksTaskContext(org.apache.hyracks.api.context.IHyracksTaskContext) AbstractSortRunGenerator(org.apache.hyracks.dataflow.std.sort.AbstractSortRunGenerator) HybridTopKSortRunGenerator(org.apache.hyracks.dataflow.std.sort.HybridTopKSortRunGenerator) Test(org.junit.Test)

Example 2 with AbstractSortRunGenerator

use of org.apache.hyracks.dataflow.std.sort.AbstractSortRunGenerator in project asterixdb by apache.

the class TopKRunGeneratorTest method testHybridTopKShouldNotGenerateAnyRuns.

@Test
public void testHybridTopKShouldNotGenerateAnyRuns() throws HyracksDataException {
    int topK = 1;
    IHyracksTaskContext ctx = AbstractRunGeneratorTest.testUtils.create(PAGE_SIZE);
    AbstractSortRunGenerator sorter = new HybridTopKSortRunGenerator(ctx, SORT_FRAME_LIMIT, topK, SortFields, null, ComparatorFactories, RecordDesc);
    testInMemoryOnly(ctx, topK, ORDER.REVERSE, sorter);
}
Also used : IHyracksTaskContext(org.apache.hyracks.api.context.IHyracksTaskContext) AbstractSortRunGenerator(org.apache.hyracks.dataflow.std.sort.AbstractSortRunGenerator) HybridTopKSortRunGenerator(org.apache.hyracks.dataflow.std.sort.HybridTopKSortRunGenerator) Test(org.junit.Test)

Example 3 with AbstractSortRunGenerator

use of org.apache.hyracks.dataflow.std.sort.AbstractSortRunGenerator in project asterixdb by apache.

the class AbstractRunGeneratorTest method testSortRecords.

protected List<GeneratedRunFileReader> testSortRecords(int pageSize, int frameLimit, int numRuns, int minRecordSize, int maxRecordSize, HashMap<Integer, String> specialData) throws HyracksDataException {
    IHyracksTaskContext ctx = testUtils.create(pageSize);
    HashMap<Integer, String> keyValuePair = new HashMap<>();
    List<IFrame> frameList = new ArrayList<>();
    prepareData(ctx, frameList, pageSize * frameLimit * numRuns, minRecordSize, maxRecordSize, specialData, keyValuePair);
    AbstractSortRunGenerator runGenerator = getSortRunGenerator(ctx, frameLimit, keyValuePair.size());
    runGenerator.open();
    for (IFrame frame : frameList) {
        runGenerator.nextFrame(frame.getBuffer());
    }
    runGenerator.close();
    matchResult(ctx, runGenerator.getRuns(), keyValuePair);
    return runGenerator.getRuns();
}
Also used : HashMap(java.util.HashMap) IFrame(org.apache.hyracks.api.comm.IFrame) IHyracksTaskContext(org.apache.hyracks.api.context.IHyracksTaskContext) ArrayList(java.util.ArrayList) AbstractSortRunGenerator(org.apache.hyracks.dataflow.std.sort.AbstractSortRunGenerator)

Aggregations

IHyracksTaskContext (org.apache.hyracks.api.context.IHyracksTaskContext)3 AbstractSortRunGenerator (org.apache.hyracks.dataflow.std.sort.AbstractSortRunGenerator)3 HybridTopKSortRunGenerator (org.apache.hyracks.dataflow.std.sort.HybridTopKSortRunGenerator)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IFrame (org.apache.hyracks.api.comm.IFrame)1