use of com.linkedin.pinot.core.segment.index.ColumnMetadata in project pinot by linkedin.
the class SegmentPreProcessorTest method testAddColumnMinMaxValue.
@Test
public void testAddColumnMinMaxValue() throws Exception {
constructSegment();
IndexLoadingConfigMetadata indexLoadingConfigMetadata = new IndexLoadingConfigMetadata(new PropertiesConfiguration());
indexLoadingConfigMetadata.setGenerateColumnMinMaxValueMode(ColumnMinMaxValueGeneratorMode.NONE.toString());
SegmentPreProcessor processor = new SegmentPreProcessor(_segmentDirectoryFile, indexLoadingConfigMetadata, null);
processor.process();
SegmentMetadataImpl segmentMetadata = new SegmentMetadataImpl(_segmentDirectoryFile);
ColumnMetadata timeColumnMetadata = segmentMetadata.getColumnMetadataFor("daysSinceEpoch");
ColumnMetadata dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column1");
ColumnMetadata metricColumnMetadata = segmentMetadata.getColumnMetadataFor("count");
Assert.assertNull(timeColumnMetadata.getMinValue());
Assert.assertNull(timeColumnMetadata.getMaxValue());
Assert.assertNull(dimensionColumnMetadata.getMinValue());
Assert.assertNull(dimensionColumnMetadata.getMaxValue());
Assert.assertNull(metricColumnMetadata.getMinValue());
Assert.assertNull(metricColumnMetadata.getMaxValue());
indexLoadingConfigMetadata = new IndexLoadingConfigMetadata(new PropertiesConfiguration());
indexLoadingConfigMetadata.setGenerateColumnMinMaxValueMode(ColumnMinMaxValueGeneratorMode.TIME.toString());
processor = new SegmentPreProcessor(_segmentDirectoryFile, indexLoadingConfigMetadata, null);
processor.process();
segmentMetadata = new SegmentMetadataImpl(_segmentDirectoryFile);
timeColumnMetadata = segmentMetadata.getColumnMetadataFor("daysSinceEpoch");
dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column5");
metricColumnMetadata = segmentMetadata.getColumnMetadataFor("count");
Assert.assertEquals(timeColumnMetadata.getMinValue(), 1756015683);
Assert.assertEquals(timeColumnMetadata.getMaxValue(), 1756015683);
Assert.assertNull(dimensionColumnMetadata.getMinValue());
Assert.assertNull(dimensionColumnMetadata.getMaxValue());
Assert.assertNull(metricColumnMetadata.getMinValue());
Assert.assertNull(metricColumnMetadata.getMaxValue());
indexLoadingConfigMetadata.setGenerateColumnMinMaxValueMode(ColumnMinMaxValueGeneratorMode.NON_METRIC.toString());
processor = new SegmentPreProcessor(_segmentDirectoryFile, indexLoadingConfigMetadata, null);
processor.process();
segmentMetadata = new SegmentMetadataImpl(_segmentDirectoryFile);
timeColumnMetadata = segmentMetadata.getColumnMetadataFor("daysSinceEpoch");
dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column5");
metricColumnMetadata = segmentMetadata.getColumnMetadataFor("count");
Assert.assertEquals(timeColumnMetadata.getMinValue(), 1756015683);
Assert.assertEquals(timeColumnMetadata.getMaxValue(), 1756015683);
Assert.assertEquals(dimensionColumnMetadata.getMinValue(), "AKXcXcIqsqOJFsdwxZ");
Assert.assertEquals(dimensionColumnMetadata.getMaxValue(), "yQkJTLOQoOqqhkAClgC");
Assert.assertNull(metricColumnMetadata.getMinValue());
Assert.assertNull(metricColumnMetadata.getMaxValue());
indexLoadingConfigMetadata.setGenerateColumnMinMaxValueMode(ColumnMinMaxValueGeneratorMode.ALL.toString());
processor = new SegmentPreProcessor(_segmentDirectoryFile, indexLoadingConfigMetadata, null);
processor.process();
segmentMetadata = new SegmentMetadataImpl(_segmentDirectoryFile);
timeColumnMetadata = segmentMetadata.getColumnMetadataFor("daysSinceEpoch");
dimensionColumnMetadata = segmentMetadata.getColumnMetadataFor("column5");
metricColumnMetadata = segmentMetadata.getColumnMetadataFor("count");
Assert.assertEquals(timeColumnMetadata.getMinValue(), 1756015683);
Assert.assertEquals(timeColumnMetadata.getMaxValue(), 1756015683);
Assert.assertEquals(dimensionColumnMetadata.getMinValue(), "AKXcXcIqsqOJFsdwxZ");
Assert.assertEquals(dimensionColumnMetadata.getMaxValue(), "yQkJTLOQoOqqhkAClgC");
Assert.assertEquals(metricColumnMetadata.getMinValue(), 890662862);
Assert.assertEquals(metricColumnMetadata.getMaxValue(), 890662862);
}
Aggregations