Search in sources :

Example 6 with ArbitraryGranularitySpec

use of io.druid.segment.indexing.granularity.ArbitraryGranularitySpec in project druid by druid-io.

the class DataSchemaTest method testDefaultExclusions.

@Test
public void testDefaultExclusions() throws Exception {
    Map<String, Object> parser = jsonMapper.convertValue(new StringInputRowParser(new JSONParseSpec(new TimestampSpec("time", "auto", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("dimB", "dimA")), null, null), null, null), null), new TypeReference<Map<String, Object>>() {
    });
    DataSchema schema = new DataSchema("test", parser, new AggregatorFactory[] { new DoubleSumAggregatorFactory("metric1", "col1"), new DoubleSumAggregatorFactory("metric2", "col2") }, new ArbitraryGranularitySpec(Granularities.DAY, ImmutableList.of(Interval.parse("2014/2015"))), jsonMapper);
    Assert.assertEquals(ImmutableSet.of("time", "col1", "col2", "metric1", "metric2"), schema.getParser().getParseSpec().getDimensionsSpec().getDimensionExclusions());
}
Also used : DoubleSumAggregatorFactory(io.druid.query.aggregation.DoubleSumAggregatorFactory) StringInputRowParser(io.druid.data.input.impl.StringInputRowParser) TimestampSpec(io.druid.data.input.impl.TimestampSpec) DimensionsSpec(io.druid.data.input.impl.DimensionsSpec) JSONParseSpec(io.druid.data.input.impl.JSONParseSpec) Map(java.util.Map) ArbitraryGranularitySpec(io.druid.segment.indexing.granularity.ArbitraryGranularitySpec) Test(org.junit.Test)

Aggregations

ArbitraryGranularitySpec (io.druid.segment.indexing.granularity.ArbitraryGranularitySpec)6 Test (org.junit.Test)6 DimensionsSpec (io.druid.data.input.impl.DimensionsSpec)5 JSONParseSpec (io.druid.data.input.impl.JSONParseSpec)5 TimestampSpec (io.druid.data.input.impl.TimestampSpec)5 DoubleSumAggregatorFactory (io.druid.query.aggregation.DoubleSumAggregatorFactory)5 StringInputRowParser (io.druid.data.input.impl.StringInputRowParser)4 Map (java.util.Map)4 DurationGranularity (io.druid.java.util.common.granularity.DurationGranularity)1 DataSegment (io.druid.timeline.DataSegment)1 File (java.io.File)1 PrintWriter (java.io.PrintWriter)1 Interval (org.joda.time.Interval)1