Search in sources :

Example 6 with BlockMultiValIterator

use of com.linkedin.pinot.core.common.BlockMultiValIterator in project pinot by linkedin.

the class ChunkIndexCreationDriverImplTest method test3.

@Test
public void test3() throws Exception {
    final IndexSegmentImpl segment = (IndexSegmentImpl) Loaders.IndexSegment.load(INDEX_DIR.listFiles()[0], ReadMode.mmap);
    final DataSource ds = segment.getDataSource("column7");
    final Block bl = ds.nextBlock();
    final BlockValSet valSet = bl.getBlockValueSet();
    final int maxValue = ((SegmentMetadataImpl) segment.getSegmentMetadata()).getColumnMetadataFor("column7").getMaxNumberOfMultiValues();
    final BlockMultiValIterator it = (BlockMultiValIterator) valSet.iterator();
    while (it.hasNext()) {
        final int[] entry = new int[maxValue];
        it.nextIntVal(entry);
        LOGGER.trace(Arrays.toString(entry));
    }
}
Also used : BlockMultiValIterator(com.linkedin.pinot.core.common.BlockMultiValIterator) IndexSegmentImpl(com.linkedin.pinot.core.segment.index.IndexSegmentImpl) Block(com.linkedin.pinot.core.common.Block) BlockValSet(com.linkedin.pinot.core.common.BlockValSet) DataSource(com.linkedin.pinot.core.common.DataSource) Test(org.testng.annotations.Test)

Example 7 with BlockMultiValIterator

use of com.linkedin.pinot.core.common.BlockMultiValIterator in project pinot by linkedin.

the class Projection method run.

public ResultTable run() {
    ResultTable resultTable = new ResultTable(_columnList, _filteredDocIds.size());
    resultTable.setResultType(ResultTable.ResultType.Selection);
    for (Pair pair : _columnList) {
        String column = (String) pair.getFirst();
        if (!_mvColumns.contains(column)) {
            BlockSingleValIterator bvIter = (BlockSingleValIterator) _indexSegment.getDataSource(column).getNextBlock().getBlockValueSet().iterator();
            int rowId = 0;
            for (Integer docId : _filteredDocIds) {
                bvIter.skipTo(docId);
                resultTable.add(rowId++, bvIter.nextIntVal());
            }
        } else {
            BlockMultiValIterator bvIter = (BlockMultiValIterator) _indexSegment.getDataSource(column).getNextBlock().getBlockValueSet().iterator();
            int rowId = 0;
            for (Integer docId : _filteredDocIds) {
                bvIter.skipTo(docId);
                int[] dictIds = _mvColumnArrayMap.get(column);
                int numMVValues = bvIter.nextIntVal(dictIds);
                dictIds = Arrays.copyOf(dictIds, numMVValues);
                resultTable.add(rowId++, ArrayUtils.toObject(dictIds));
            }
        }
    }
    return transformFromIdToValues(resultTable, _dictionaryMap, _addCountStar);
}
Also used : BlockMultiValIterator(com.linkedin.pinot.core.common.BlockMultiValIterator) BlockSingleValIterator(com.linkedin.pinot.core.common.BlockSingleValIterator) Pair(com.linkedin.pinot.core.query.utils.Pair)

Aggregations

BlockMultiValIterator (com.linkedin.pinot.core.common.BlockMultiValIterator)7 BlockSingleValIterator (com.linkedin.pinot.core.common.BlockSingleValIterator)4 Block (com.linkedin.pinot.core.common.Block)3 DataSource (com.linkedin.pinot.core.common.DataSource)3 BlockMetadata (com.linkedin.pinot.core.common.BlockMetadata)2 BlockValSet (com.linkedin.pinot.core.common.BlockValSet)2 FieldSpec (com.linkedin.pinot.common.data.FieldSpec)1 ServerMetrics (com.linkedin.pinot.common.metrics.ServerMetrics)1 BlockValIterator (com.linkedin.pinot.core.common.BlockValIterator)1 GenericRow (com.linkedin.pinot.core.data.GenericRow)1 HLRealtimeSegmentDataManager (com.linkedin.pinot.core.data.manager.realtime.HLRealtimeSegmentDataManager)1 Pair (com.linkedin.pinot.core.query.utils.Pair)1 RealtimeSegment (com.linkedin.pinot.core.realtime.RealtimeSegment)1 RealtimeColumnDataSource (com.linkedin.pinot.core.realtime.impl.datasource.RealtimeColumnDataSource)1 IndexSegmentImpl (com.linkedin.pinot.core.segment.index.IndexSegmentImpl)1 Dictionary (com.linkedin.pinot.core.segment.index.readers.Dictionary)1 MetricsRegistry (com.yammer.metrics.core.MetricsRegistry)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1