mirror of https://github.com/apache/druid.git
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:
parent
379ca87e6a
commit
6b908a5061
|
@ -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) {
|
||||
|
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue