Source:
public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") InputRowParser parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec ) { Preconditions.checkNotNull(dataSource, "dataSource cannot be null. Please provide a dataSource."); Preconditions.checkNotNull(aggregators, "metricsSpec cannot be null. Please provide a metricsSpec."); this.dataSource = dataSource; final Set<String> dimensionExclusions = Sets.newHashSet(); for (AggregatorFactory aggregator : aggregators) { dimensionExclusions.addAll(aggregator.requiredFields()); } if (parser != null && parser.getParseSpec() != null) { final DimensionsSpec dimensionsSpec = parser.getParseSpec().getDimensionsSpec(); final TimestampSpec timestampSpec = parser.getParseSpec().getTimestampSpec(); if (timestampSpec != null) { final String timestampColumn = timestampSpec.getTimestampColumn(); if (!(dimensionsSpec.hasCustomDimensions() && dimensionsSpec.getDimensions().contains(timestampColumn))) { dimensionExclusions.add(timestampColumn); } } if (dimensionsSpec != null) { this.parser = parser.withParseSpec( parser.getParseSpec() .withDimensionsSpec( dimensionsSpec .withDimensionExclusions( Sets.difference( dimensionExclusions, Sets.newHashSet(dimensionsSpec.getDimensions()) ) ) ) ); } else { this.parser = parser; } } else { log.warn("No parser or parseSpec has been specified"); this.parser = parser; } this.aggregators = aggregators; if (granularitySpec == null) { log.warn("No granularitySpec has been specified. Using UniformGranularitySpec as default."); this.granularitySpec = new UniformGranularitySpec(null, null, null); } else { this.granularitySpec = granularitySpec; } }

Target:
public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") InputRowParser parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec ) { Preconditions.checkNotNull(dataSource, "dataSource cannot be null. Please provide a dataSource."); this.dataSource = dataSource; final Set<String> dimensionExclusions = Sets.newHashSet(); for (AggregatorFactory aggregator : aggregators) { dimensionExclusions.addAll(aggregator.requiredFields()); } if (parser != null && parser.getParseSpec() != null) { final DimensionsSpec dimensionsSpec = parser.getParseSpec().getDimensionsSpec(); final TimestampSpec timestampSpec = parser.getParseSpec().getTimestampSpec(); if (timestampSpec != null) { final String timestampColumn = timestampSpec.getTimestampColumn(); if (!(dimensionsSpec.hasCustomDimensions() && dimensionsSpec.getDimensions().contains(timestampColumn))) { dimensionExclusions.add(timestampColumn); } } if (dimensionsSpec != null) { this.parser = parser.withParseSpec( parser.getParseSpec() .withDimensionsSpec( dimensionsSpec .withDimensionExclusions( Sets.difference( dimensionExclusions, Sets.newHashSet(dimensionsSpec.getDimensions()) ) ) ) ); } else { this.parser = parser; } } else { log.warn("No parser or parseSpec has been specified"); this.parser = parser; } if (aggregators.length == 0) { log.warn("No metricsSpec has been specified. Are you sure this is what you want?"); } this.aggregators = aggregators; if (granularitySpec == null) { log.warn("No granularitySpec has been specified. Using UniformGranularitySpec as default."); this.granularitySpec = new UniformGranularitySpec(null, null, null); } else { this.granularitySpec = granularitySpec; } }