Source:
<code>private DimensionSelector makeDimensionSelectorUndecorated(DimensionSpec dimensionSpec) { final String dimension = dimensionSpec.getDimension(); final ExtractionFn extractionFn = dimensionSpec.getExtractionFn(); final boolean isTimeColumn = dimensionSpec.getDimension().equals(Column.TIME_COLUMN_NAME); if (isTimeColumn && extractionFn == null) { throw new UnsupportedOperationException("time dimension must provide an extraction function"); } return new DimensionSelector() { @Override public IndexedInts getRow() { final int dimensionValuesSize; <START> if (isTimeColumn) { <END> dimensionValuesSize = 1; } else { final List<String> dimensionValues = row.get().getDimension(dimension); dimensionValuesSize = dimensionValues != null ? dimensionValues.size() : 0; } return new IndexedInts() { @Override public int size() { return dimensionValuesSize; } @Override public int get(int index) { if (index < 0 || index >= dimensionValuesSize) { throw new IndexOutOfBoundsException("index: " + index); } return index; } @Override public IntIterator iterator() { return IntIterators.fromTo(0, dimensionValuesSize); } @Override public void close() throws IOException { } @Override public void fill(int index, int[] toFill) { throw new UnsupportedOperationException("fill not supported"); } }; } @Override public int getValueCardinality() { return DimensionSelector.CARDINALITY_UNKNOWN; } @Override public String lookupName(int id) { if (isTimeColumn) { return extractionFn.apply(row.get().getTimestampFromEpoch()); } else { final String value = Strings.emptyToNull(row.get().getDimension(dimension).get(id)); return extractionFn == null ? value : extractionFn.apply(value); } } @Override public int lookupId(String name) { throw new UnsupportedOperationException("cannot lookup names to ids"); } }; }</code><technical_language>I move this check out of DimensionSelector, i. e. return DimensionSelectors for time column other columns. DimensionSelector for timeColumn extracted ZeroDimensionSelector (there places in codebase anonymous DimensionSelectors logic created, replaced ZeroDimensionSelector.instance()). ZeroDimensionSelector return optimized IndexedInts: constant size, IntIterators.singleton(0), simpler check in get()</technical_language>

Target:
private DimensionSelector makeDimensionSelectorUndecorated(DimensionSpec dimensionSpec) { final String dimension = dimensionSpec.getDimension(); final ExtractionFn extractionFn = dimensionSpec.getExtractionFn(); if (Column.TIME_COLUMN_NAME.equals(dimensionSpec.getDimension())) { if (extractionFn == null) { throw new UnsupportedOperationException("time dimension must provide an extraction function"); } return new DimensionSelector() { @Override public IndexedInts getRow() { return ZeroIndexedInts.instance(); } @Override public int getValueCardinality() { return DimensionSelector.CARDINALITY_UNKNOWN; } @Override public String lookupName(int id) { return extractionFn.apply(row.get().getTimestampFromEpoch()); } @Override public int lookupId(String name) { throw new UnsupportedOperationException("lookupId"); } }; } else { return new DimensionSelector() { @Override public IndexedInts getRow() { final List<String> dimensionValues = row.get().getDimension(dimension); return RangeIndexedInts.create(dimensionValues != null ? dimensionValues.size() : 0); } @Override public int getValueCardinality() { return DimensionSelector.CARDINALITY_UNKNOWN; } @Override public String lookupName(int id) { final String value = Strings.emptyToNull(row.get().getDimension(dimension).get(id)); return extractionFn == null ? value : extractionFn.apply(value); } @Override public int lookupId(String name) { throw new UnsupportedOperationException("lookupId"); } }; } }