Source:
private static DataSchema createDataSchema( String dataSource, Interval totalInterval, List<TimelineObjectHolder<String, DataSegment>> timelineObjectHolder, DimensionsSpec dimensionsSpec, IndexIO indexIO, ObjectMapper jsonMapper, Map<DataSegment, File> segmentFileMap ) throws IOException { final List<Pair<QueryableIndex, DataSegment>> queryableIndexAndSegments = loadSegments( timelineObjectHolder, 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( GranularityType.NONE.getDefaultGranularity(), rollup, Collections.singletonList(totalInterval) ); 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 ); }

Target:
private static DataSchema createDataSchema( String dataSource, Interval totalInterval, List<TimelineObjectHolder<String, DataSegment>> timelineObjectHolder, DimensionsSpec dimensionsSpec, IndexIO indexIO, ObjectMapper jsonMapper, Map<DataSegment, File> segmentFileMap ) throws IOException { final List<Pair<QueryableIndex, DataSegment>> queryableIndexAndSegments = loadSegments( timelineObjectHolder, 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( Granularities.NONE, rollup, Collections.singletonList(totalInterval) ); 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 ); }