Source:
private static DataSchema createDataSchema( String dataSource, Interval interval, DimensionsSpec dimensionsSpec, IndexIO indexIO, ObjectMapper jsonMapper, List<TimelineObjectHolder<String, DataSegment>> timelineSegments, Map<DataSegment, File> segmentFileMap ) throws IOException { final List<QueryableIndex> queryableIndices = loadSegments(timelineSegments, segmentFileMap, indexIO); for (QueryableIndex index : queryableIndices) { if (index.getMetadata() == null) { throw new RE("Index metadata doesn't exist for interval[%s]", index.getDataInterval()); } } final List<AggregatorFactory[]> aggregatorFactories = queryableIndices .stream() .map(index -> index.getMetadata().getAggregators()) .collect(Collectors.toList()); final AggregatorFactory[] mergedAggregators = AggregatorFactory.mergeAggregators(aggregatorFactories); if (mergedAggregators == null) { throw new ISE("Failed to merge aggregators[%s]", aggregatorFactories); } final boolean rollup = queryableIndices.stream().allMatch(index -> { final Boolean isRollup = index.getMetadata().isRollup(); return isRollup != null && isRollup; }); final GranularitySpec granularitySpec = new ArbitraryGranularitySpec( new NoneGranularity(), rollup, ImmutableList.of(interval) ); final DimensionsSpec finalDimensionsSpec = dimensionsSpec == null ? createDimensionsSpec(queryableIndices) : dimensionsSpec; final InputRowParser parser = new NoopInputRowParser(new TimeAndDimsParseSpec(null, finalDimensionsSpec)); return new DataSchema( dataSource, jsonMapper.convertValue(parser, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT), mergedAggregators, granularitySpec, null, jsonMapper ); }

Target:
private static DataSchema createDataSchema( String dataSource, Interval interval, DimensionsSpec dimensionsSpec, IndexIO indexIO, ObjectMapper jsonMapper, List<TimelineObjectHolder<String, DataSegment>> timelineSegments, Map<DataSegment, File> segmentFileMap ) throws IOException { final List<Pair<QueryableIndex, DataSegment>> queryableIndexAndSegments = loadSegments( timelineSegments, segmentFileMap, indexIO ); for (Pair<QueryableIndex, DataSegment> pair : queryableIndexAndSegments) { final QueryableIndex index = pair.lhs; if (index.getMetadata() == null) { throw new RE("Index metadata doesn't exist for segment[%s]", pair.rhs.getIdentifier()); } } final List<AggregatorFactory[]> aggregatorFactories = queryableIndexAndSegments .stream() .map(pair -> pair.lhs.getMetadata().getAggregators()) .collect(Collectors.toList()); final AggregatorFactory[] mergedAggregators = AggregatorFactory.mergeAggregators(aggregatorFactories); if (mergedAggregators == null) { throw new ISE("Failed to merge aggregators[%s]", aggregatorFactories); } final boolean rollup = queryableIndexAndSegments.stream().allMatch(pair -> { final Boolean isRollup = pair.lhs.getMetadata().isRollup(); return isRollup != null && isRollup; }); final GranularitySpec granularitySpec = new ArbitraryGranularitySpec( new NoneGranularity(), rollup, ImmutableList.of(interval) ); final DimensionsSpec finalDimensionsSpec = dimensionsSpec == null ? createDimensionsSpec(queryableIndexAndSegments) : dimensionsSpec; final InputRowParser parser = new NoopInputRowParser(new TimeAndDimsParseSpec(null, finalDimensionsSpec)); return new DataSchema( dataSource, jsonMapper.convertValue(parser, JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT), mergedAggregators, granularitySpec, null, jsonMapper ); }