DataSchema: Exclude metric names from dimension list.

Otherwise we could end up with a metric and a dimension with the same column name.
This commit is contained in:
Gian Merlino 2015-11-06 17:57:41 -08:00
parent 379ca87e6a
commit 6b908a5061
2 changed files with 3 additions and 2 deletions

View File

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

View File

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