use of com.linkedin.pinot.core.segment.creator.impl.stats.StringColumnPreIndexStatsCollector in project pinot by linkedin.
the class DictionariesTest method testStringColumnPreIndexStatsCollectorForBoolean.
@Test
public void testStringColumnPreIndexStatsCollectorForBoolean() throws Exception {
FieldSpec spec = new DimensionFieldSpec("column1", DataType.BOOLEAN, true);
AbstractColumnStatisticsCollector statsCollector = new StringColumnPreIndexStatsCollector(spec);
statsCollector.collect("false");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("false");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("false");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("true");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("true");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("false");
Assert.assertFalse(statsCollector.isSorted());
statsCollector.collect("false");
Assert.assertFalse(statsCollector.isSorted());
statsCollector.collect("true");
Assert.assertFalse(statsCollector.isSorted());
statsCollector.seal();
Assert.assertEquals(statsCollector.getCardinality(), 2);
Assert.assertEquals((statsCollector.getMinValue()).toString(), "false");
Assert.assertEquals((statsCollector.getMaxValue()).toString(), "true");
Assert.assertFalse(statsCollector.isSorted());
}
use of com.linkedin.pinot.core.segment.creator.impl.stats.StringColumnPreIndexStatsCollector in project pinot by linkedin.
the class DictionariesTest method testStringColumnPreIndexStatsCollectorForRandomString.
@Test
public void testStringColumnPreIndexStatsCollectorForRandomString() throws Exception {
FieldSpec spec = new DimensionFieldSpec("column1", DataType.STRING, true);
AbstractColumnStatisticsCollector statsCollector = new StringColumnPreIndexStatsCollector(spec);
statsCollector.collect("a");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("b");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("c");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("d");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("d");
Assert.assertTrue(statsCollector.isSorted());
statsCollector.collect("b");
Assert.assertFalse(statsCollector.isSorted());
statsCollector.collect("z");
Assert.assertFalse(statsCollector.isSorted());
statsCollector.collect("u");
Assert.assertFalse(statsCollector.isSorted());
statsCollector.seal();
Assert.assertEquals(statsCollector.getCardinality(), 6);
Assert.assertEquals((statsCollector.getMinValue()).toString(), "a");
Assert.assertEquals((statsCollector.getMaxValue()).toString(), "z");
Assert.assertFalse(statsCollector.isSorted());
}
Aggregations