Search in sources :

Example 1 with ColumnMinMaxValueGenerator

use of com.linkedin.pinot.core.segment.index.loader.columnminmaxvalue.ColumnMinMaxValueGenerator in project pinot by linkedin.

the class SegmentPreProcessor method process.

public void process() throws Exception {
    SegmentDirectory.Writer segmentWriter = null;
    try {
        segmentWriter = _segmentDirectory.createWriter();
        // Create column inverted indices according to the index config.
        InvertedIndexHandler invertedIndexHandler = new InvertedIndexHandler(_indexDir, _segmentMetadata, _indexConfig, segmentWriter);
        invertedIndexHandler.createInvertedIndices();
        if (_segmentMetadata.getTotalDocs() != 0) {
            if (_enableDefaultColumns && (_schema != null)) {
                // Update default columns according to the schema.
                // NOTE: This step may modify the segment metadata. When adding new steps after this, reload the metadata.
                DefaultColumnHandler defaultColumnHandler = DefaultColumnHandlerFactory.getDefaultColumnHandler(_indexDir, _schema, _segmentMetadata, segmentWriter);
                defaultColumnHandler.updateDefaultColumns();
            }
            if (_columnMinMaxValueGeneratorMode != ColumnMinMaxValueGeneratorMode.NONE) {
                // Add min/max value to column metadata according to the prune mode.
                // For star-tree index, because it can only increase the range, so min/max value can still be used in pruner.
                // NOTE: This step may modify the segment metadata. When adding new steps after this, reload the metadata.
                // Reload the metadata.
                _segmentMetadata = new SegmentMetadataImpl(_indexDir);
                ColumnMinMaxValueGenerator columnMinMaxValueGenerator = new ColumnMinMaxValueGenerator(_indexDir, _segmentMetadata, segmentWriter, _columnMinMaxValueGeneratorMode);
                columnMinMaxValueGenerator.addColumnMinMaxValue();
            }
        }
    } finally {
        if (segmentWriter != null) {
            segmentWriter.saveAndClose();
        }
    }
}
Also used : DefaultColumnHandler(com.linkedin.pinot.core.segment.index.loader.defaultcolumn.DefaultColumnHandler) InvertedIndexHandler(com.linkedin.pinot.core.segment.index.loader.invertedindex.InvertedIndexHandler) ColumnMinMaxValueGenerator(com.linkedin.pinot.core.segment.index.loader.columnminmaxvalue.ColumnMinMaxValueGenerator) SegmentMetadataImpl(com.linkedin.pinot.core.segment.index.SegmentMetadataImpl) SegmentDirectory(com.linkedin.pinot.core.segment.store.SegmentDirectory)

Aggregations

SegmentMetadataImpl (com.linkedin.pinot.core.segment.index.SegmentMetadataImpl)1 ColumnMinMaxValueGenerator (com.linkedin.pinot.core.segment.index.loader.columnminmaxvalue.ColumnMinMaxValueGenerator)1 DefaultColumnHandler (com.linkedin.pinot.core.segment.index.loader.defaultcolumn.DefaultColumnHandler)1 InvertedIndexHandler (com.linkedin.pinot.core.segment.index.loader.invertedindex.InvertedIndexHandler)1 SegmentDirectory (com.linkedin.pinot.core.segment.store.SegmentDirectory)1