Search in sources :

Example 1 with SingleScanTimeDimensionSelector

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

the class IncrementalIndexColumnSelectorFactory method makeDimensionSelectorUndecorated.

private DimensionSelector makeDimensionSelectorUndecorated(DimensionSpec dimensionSpec) {
    final String dimension = dimensionSpec.getDimension();
    final ExtractionFn extractionFn = dimensionSpec.getExtractionFn();
    if (dimension.equals(ColumnHolder.TIME_COLUMN_NAME)) {
        return new SingleScanTimeDimensionSelector(makeColumnValueSelector(dimension), extractionFn, descending);
    }
    final IncrementalIndex.DimensionDesc dimensionDesc = index.getDimension(dimensionSpec.getDimension());
    if (dimensionDesc == null) {
        // not a dimension, column may be a metric
        ColumnCapabilities capabilities = getColumnCapabilities(dimension);
        if (capabilities == null) {
            return DimensionSelector.constant(null, extractionFn);
        }
        if (capabilities.isNumeric()) {
            return ValueTypes.makeNumericWrappingDimensionSelector(capabilities.getType(), makeColumnValueSelector(dimension), extractionFn);
        }
        // if we can't wrap the base column, just return a column of all nulls
        return DimensionSelector.constant(null, extractionFn);
    } else {
        final DimensionIndexer indexer = dimensionDesc.getIndexer();
        return indexer.makeDimensionSelector(dimensionSpec, rowHolder, dimensionDesc);
    }
}
Also used : ExtractionFn(org.apache.druid.query.extraction.ExtractionFn) DimensionIndexer(org.apache.druid.segment.DimensionIndexer) SingleScanTimeDimensionSelector(org.apache.druid.segment.SingleScanTimeDimensionSelector) ColumnCapabilities(org.apache.druid.segment.column.ColumnCapabilities)

Aggregations

ExtractionFn (org.apache.druid.query.extraction.ExtractionFn)1 DimensionIndexer (org.apache.druid.segment.DimensionIndexer)1 SingleScanTimeDimensionSelector (org.apache.druid.segment.SingleScanTimeDimensionSelector)1 ColumnCapabilities (org.apache.druid.segment.column.ColumnCapabilities)1