Merge pull request #1932 from gianm/data-schema-exclude-metric-names

DataSchema: Exclude metric names from dimension list.
This commit is contained in:
Fangjin Yang 2015-11-07 15:22:33 -08:00
commit fe6efb6367
2 changed files with 3 additions and 2 deletions

View File

@ -101,6 +101,7 @@ public class DataSchema
final Set<String> dimensionExclusions = Sets.newHashSet(); final Set<String> dimensionExclusions = Sets.newHashSet();
for (AggregatorFactory aggregator : aggregators) { for (AggregatorFactory aggregator : aggregators) {
dimensionExclusions.addAll(aggregator.requiredFields()); dimensionExclusions.addAll(aggregator.requiredFields());
dimensionExclusions.add(aggregator.getName());
} }
if (inputRowParser.getParseSpec() != null) { if (inputRowParser.getParseSpec() != null) {

View File

@ -72,7 +72,7 @@ public class DataSchemaTest
); );
Assert.assertEquals( Assert.assertEquals(
ImmutableSet.of("time", "col1", "col2"), ImmutableSet.of("time", "col1", "col2", "metric1", "metric2"),
schema.getParser().getParseSpec().getDimensionsSpec().getDimensionExclusions() schema.getParser().getParseSpec().getDimensionsSpec().getDimensionExclusions()
); );
} }
@ -101,7 +101,7 @@ public class DataSchemaTest
); );
Assert.assertEquals( Assert.assertEquals(
ImmutableSet.of("dimC", "col1"), ImmutableSet.of("dimC", "col1", "metric1", "metric2"),
schema.getParser().getParseSpec().getDimensionsSpec().getDimensionExclusions() schema.getParser().getParseSpec().getDimensionsSpec().getDimensionExclusions()
); );
} }