Search in sources :

Example 1 with Point

use of org.apache.druid.collections.spatial.Point in project druid by druid-io.

the class LinearGutmanSplitStrategyTest method testPickSeeds.

@Test
public void testPickSeeds() {
    BitmapFactory bf = new ConciseBitmapFactory();
    LinearGutmanSplitStrategy strategy = new LinearGutmanSplitStrategy(0, 50, bf);
    Node node = new Node(new float[2], new float[2], true, bf);
    node.addChild(new Point(new float[] { 3, 7 }, 1, bf));
    node.addChild(new Point(new float[] { 1, 6 }, 1, bf));
    node.addChild(new Point(new float[] { 9, 8 }, 1, bf));
    node.addChild(new Point(new float[] { 2, 5 }, 1, bf));
    node.addChild(new Point(new float[] { 4, 4 }, 1, bf));
    node.enclose();
    Node[] groups = strategy.split(node);
    Assert.assertEquals(groups[0].getMinCoordinates()[0], 1.0f);
    Assert.assertEquals(groups[0].getMinCoordinates()[1], 4.0f);
    Assert.assertEquals(groups[1].getMinCoordinates()[0], 9.0f);
    Assert.assertEquals(groups[1].getMinCoordinates()[1], 8.0f);
}
Also used : ConciseBitmapFactory(org.apache.druid.collections.bitmap.ConciseBitmapFactory) Node(org.apache.druid.collections.spatial.Node) BitmapFactory(org.apache.druid.collections.bitmap.BitmapFactory) ConciseBitmapFactory(org.apache.druid.collections.bitmap.ConciseBitmapFactory) RoaringBitmapFactory(org.apache.druid.collections.bitmap.RoaringBitmapFactory) Point(org.apache.druid.collections.spatial.Point) Test(org.junit.Test)

Example 2 with Point

use of org.apache.druid.collections.spatial.Point in project druid by druid-io.

the class LinearGutmanSplitStrategyTest method testPickSeedsRoaring.

@Test
public void testPickSeedsRoaring() {
    BitmapFactory bf = new RoaringBitmapFactory();
    LinearGutmanSplitStrategy strategy = new LinearGutmanSplitStrategy(0, 50, bf);
    Node node = new Node(new float[2], new float[2], true, bf);
    node.addChild(new Point(new float[] { 3, 7 }, 1, bf));
    node.addChild(new Point(new float[] { 1, 6 }, 1, bf));
    node.addChild(new Point(new float[] { 9, 8 }, 1, bf));
    node.addChild(new Point(new float[] { 2, 5 }, 1, bf));
    node.addChild(new Point(new float[] { 4, 4 }, 1, bf));
    node.enclose();
    Node[] groups = strategy.split(node);
    Assert.assertEquals(groups[0].getMinCoordinates()[0], 1.0f);
    Assert.assertEquals(groups[0].getMinCoordinates()[1], 4.0f);
    Assert.assertEquals(groups[1].getMinCoordinates()[0], 9.0f);
    Assert.assertEquals(groups[1].getMinCoordinates()[1], 8.0f);
}
Also used : Node(org.apache.druid.collections.spatial.Node) BitmapFactory(org.apache.druid.collections.bitmap.BitmapFactory) ConciseBitmapFactory(org.apache.druid.collections.bitmap.ConciseBitmapFactory) RoaringBitmapFactory(org.apache.druid.collections.bitmap.RoaringBitmapFactory) Point(org.apache.druid.collections.spatial.Point) RoaringBitmapFactory(org.apache.druid.collections.bitmap.RoaringBitmapFactory) Test(org.junit.Test)

Aggregations

BitmapFactory (org.apache.druid.collections.bitmap.BitmapFactory)2 ConciseBitmapFactory (org.apache.druid.collections.bitmap.ConciseBitmapFactory)2 RoaringBitmapFactory (org.apache.druid.collections.bitmap.RoaringBitmapFactory)2 Node (org.apache.druid.collections.spatial.Node)2 Point (org.apache.druid.collections.spatial.Point)2 Test (org.junit.Test)2