Search in sources :

Example 1 with FloatColumnPreIndexStatsCollector

use of com.linkedin.pinot.core.segment.creator.impl.stats.FloatColumnPreIndexStatsCollector in project pinot by linkedin.

the class DictionariesTest method testFloatColumnPreIndexStatsCollector.

@Test
public void testFloatColumnPreIndexStatsCollector() throws Exception {
    FieldSpec spec = new DimensionFieldSpec("column1", DataType.FLOAT, true);
    AbstractColumnStatisticsCollector statsCollector = new FloatColumnPreIndexStatsCollector(spec);
    statsCollector.collect(new Integer(1));
    Assert.assertTrue(statsCollector.isSorted());
    statsCollector.collect(new Float(2));
    Assert.assertTrue(statsCollector.isSorted());
    statsCollector.collect(new Long(3));
    Assert.assertTrue(statsCollector.isSorted());
    statsCollector.collect(new Double(4));
    Assert.assertTrue(statsCollector.isSorted());
    statsCollector.collect(new Integer(4));
    Assert.assertTrue(statsCollector.isSorted());
    statsCollector.collect(new Float(2));
    Assert.assertFalse(statsCollector.isSorted());
    statsCollector.collect(new Double(40));
    Assert.assertFalse(statsCollector.isSorted());
    statsCollector.collect(new Double(20));
    Assert.assertFalse(statsCollector.isSorted());
    statsCollector.seal();
    Assert.assertEquals(statsCollector.getCardinality(), 6);
    Assert.assertEquals(((Number) statsCollector.getMinValue()).intValue(), 1);
    Assert.assertEquals(((Number) statsCollector.getMaxValue()).intValue(), 40);
    Assert.assertFalse(statsCollector.isSorted());
}
Also used : AbstractColumnStatisticsCollector(com.linkedin.pinot.core.segment.creator.AbstractColumnStatisticsCollector) FieldSpec(com.linkedin.pinot.common.data.FieldSpec) DimensionFieldSpec(com.linkedin.pinot.common.data.DimensionFieldSpec) DimensionFieldSpec(com.linkedin.pinot.common.data.DimensionFieldSpec) FloatColumnPreIndexStatsCollector(com.linkedin.pinot.core.segment.creator.impl.stats.FloatColumnPreIndexStatsCollector) Test(org.testng.annotations.Test)

Aggregations

DimensionFieldSpec (com.linkedin.pinot.common.data.DimensionFieldSpec)1 FieldSpec (com.linkedin.pinot.common.data.FieldSpec)1 AbstractColumnStatisticsCollector (com.linkedin.pinot.core.segment.creator.AbstractColumnStatisticsCollector)1 FloatColumnPreIndexStatsCollector (com.linkedin.pinot.core.segment.creator.impl.stats.FloatColumnPreIndexStatsCollector)1 Test (org.testng.annotations.Test)1