Search in sources :

Example 1 with RowPointer

use of org.apache.druid.segment.RowPointer in project druid by druid-io.

the class IncrementalIndexRowIterator method makeRowPointer.

private static RowPointer makeRowPointer(IncrementalIndex incrementalIndex, IncrementalIndexRowHolder rowHolder, RowNumCounter rowNumCounter) {
    ColumnSelectorFactory columnSelectorFactory = new IncrementalIndexColumnSelectorFactory(new IncrementalIndexStorageAdapter(incrementalIndex), VirtualColumns.EMPTY, false, rowHolder);
    ColumnValueSelector[] dimensionSelectors = incrementalIndex.getDimensions().stream().map(dim -> {
        ColumnValueSelector selectorWithUnsortedValues = columnSelectorFactory.makeColumnValueSelector(dim.getName());
        return dim.getIndexer().convertUnsortedValuesToSorted(selectorWithUnsortedValues);
    }).toArray(ColumnValueSelector[]::new);
    List<DimensionHandler> dimensionHandlers = incrementalIndex.getDimensions().stream().map(IncrementalIndex.DimensionDesc::getHandler).collect(Collectors.toList());
    ColumnValueSelector[] metricSelectors = incrementalIndex.getMetricNames().stream().map(columnSelectorFactory::makeColumnValueSelector).toArray(ColumnValueSelector[]::new);
    return new RowPointer(rowHolder, dimensionSelectors, dimensionHandlers, metricSelectors, incrementalIndex.getMetricNames(), rowNumCounter);
}
Also used : VirtualColumns(org.apache.druid.segment.VirtualColumns) Iterator(java.util.Iterator) ColumnValueSelector(org.apache.druid.segment.ColumnValueSelector) IndexableAdapter(org.apache.druid.segment.IndexableAdapter) TimeAndDimsPointer(org.apache.druid.segment.TimeAndDimsPointer) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) ColumnSelectorFactory(org.apache.druid.segment.ColumnSelectorFactory) List(java.util.List) DimensionHandler(org.apache.druid.segment.DimensionHandler) RowPointer(org.apache.druid.segment.RowPointer) RowNumCounter(org.apache.druid.segment.RowNumCounter) TransformableRowIterator(org.apache.druid.segment.TransformableRowIterator) ColumnSelectorFactory(org.apache.druid.segment.ColumnSelectorFactory) DimensionHandler(org.apache.druid.segment.DimensionHandler) RowPointer(org.apache.druid.segment.RowPointer) ColumnValueSelector(org.apache.druid.segment.ColumnValueSelector)

Aggregations

Iterator (java.util.Iterator)1 List (java.util.List)1 Objects (java.util.Objects)1 Collectors (java.util.stream.Collectors)1 ColumnSelectorFactory (org.apache.druid.segment.ColumnSelectorFactory)1 ColumnValueSelector (org.apache.druid.segment.ColumnValueSelector)1 DimensionHandler (org.apache.druid.segment.DimensionHandler)1 IndexableAdapter (org.apache.druid.segment.IndexableAdapter)1 RowNumCounter (org.apache.druid.segment.RowNumCounter)1 RowPointer (org.apache.druid.segment.RowPointer)1 TimeAndDimsPointer (org.apache.druid.segment.TimeAndDimsPointer)1 TransformableRowIterator (org.apache.druid.segment.TransformableRowIterator)1 VirtualColumns (org.apache.druid.segment.VirtualColumns)1