Search in sources :

Example 26 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method runTestIntersectInplace.

private void runTestIntersectInplace(LongList intervals, int divider, String expected) {
    LongList copy = new LongList();
    copy.add(intervals, divider, intervals.size());
    copy.add(intervals, 0, divider);
    IntervalUtils.intersectInplace(intervals, divider);
    TestUtils.assertEquals(expected, toIntervalString(intervals, 0));
    IntervalUtils.intersectInplace(copy, copy.size() - divider);
    TestUtils.assertEquals(expected, toIntervalString(copy, 0));
}
Also used : LongList(io.questdb.std.LongList)

Example 27 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testIntersectInplace4.

@Test
public void testIntersectInplace4() {
    LongList intervals = new LongList();
    // A
    add(intervals, -5, -3);
    add(intervals, -1, 10);
    add(intervals, 12, 13);
    // B
    add(intervals, -20, -2);
    add(intervals, 1, 2);
    add(intervals, 4, 5);
    add(intervals, 7, 7);
    add(intervals, 9, 12);
    runTestIntersectInplace(intervals, 6, "[-5,-3], [1,2], [4,5], [7,7], [9,10], [12,12]");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Example 28 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testInvertSimple.

@Test
public void testInvertSimple() {
    LongList intervals = new LongList();
    // A
    add(intervals, -20, -2);
    // B
    add(intervals, 1, 2);
    runTestInvertInplace(intervals, 2, "[NaN,0], [3,9223372036854775807]");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Example 29 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testUnionAllAfterB.

@Test
public void testUnionAllAfterB() {
    LongList intervals = new LongList();
    // A
    add(intervals, 100, 101);
    add(intervals, 200, 201);
    add(intervals, 205, 206);
    // B
    add(intervals, 1, 2);
    add(intervals, 3, 4);
    add(intervals, 6, 7);
    runTestUnionInplace(intervals, 6, "[1,2], [3,4], [6,7], [100,101], [200,201], [205,206]");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Example 30 with LongList

use of io.questdb.std.LongList in project questdb by bluestreak01.

the class IntervalUtilsTest method testInvertWithPositiveInfinity.

@Test
public void testInvertWithPositiveInfinity() {
    LongList intervals = new LongList();
    // A
    // B
    add(intervals, Long.MIN_VALUE, 2);
    add(intervals, 100, 200);
    runTestInvertInplace(intervals, 0, "[3,99], [201,9223372036854775807]");
}
Also used : LongList(io.questdb.std.LongList) Test(org.junit.Test)

Aggregations

LongList (io.questdb.std.LongList)30 Test (org.junit.Test)25 LongTreeSet (io.questdb.griffin.engine.table.LongTreeSet)3 Rnd (io.questdb.std.Rnd)2 CyclicBarrier (java.util.concurrent.CyclicBarrier)2 GriffinParserTestUtils.intervalToString (io.questdb.griffin.GriffinParserTestUtils.intervalToString)1 SOCountDownLatch (io.questdb.mp.SOCountDownLatch)1 ObjList (io.questdb.std.ObjList)1 Random (java.util.Random)1 BrokenBarrierException (java.util.concurrent.BrokenBarrierException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1