Search in sources :

Example 26 with IncrementalIndexSegment

use of io.druid.segment.IncrementalIndexSegment in project druid by druid-io.

the class MultiSegmentSelectQueryTest method setup.

@BeforeClass
public static void setup() throws IOException {
    CharSource v_0112 = CharSource.wrap(StringUtils.join(V_0112, "\n"));
    CharSource v_0113 = CharSource.wrap(StringUtils.join(V_0113, "\n"));
    CharSource v_override = CharSource.wrap(StringUtils.join(V_OVERRIDE, "\n"));
    IncrementalIndex index0 = TestIndex.loadIncrementalIndex(newIndex("2011-01-12T00:00:00.000Z"), v_0112);
    IncrementalIndex index1 = TestIndex.loadIncrementalIndex(newIndex("2011-01-13T00:00:00.000Z"), v_0113);
    IncrementalIndex index2 = TestIndex.loadIncrementalIndex(newIndex("2011-01-12T04:00:00.000Z"), v_override);
    segment0 = new IncrementalIndexSegment(index0, makeIdentifier(index0, "v1"));
    segment1 = new IncrementalIndexSegment(index1, makeIdentifier(index1, "v1"));
    segment_override = new IncrementalIndexSegment(index2, makeIdentifier(index2, "v2"));
    VersionedIntervalTimeline<String, Segment> timeline = new VersionedIntervalTimeline(StringComparators.LEXICOGRAPHIC);
    timeline.add(index0.getInterval(), "v1", new SingleElementPartitionChunk(segment0));
    timeline.add(index1.getInterval(), "v1", new SingleElementPartitionChunk(segment1));
    timeline.add(index2.getInterval(), "v2", new SingleElementPartitionChunk(segment_override));
    segmentIdentifiers = Lists.newArrayList();
    for (TimelineObjectHolder<String, ?> holder : timeline.lookup(new Interval("2011-01-12/2011-01-14"))) {
        segmentIdentifiers.add(makeIdentifier(holder.getInterval(), holder.getVersion()));
    }
    runner = QueryRunnerTestHelper.makeFilteringQueryRunner(timeline, factory);
}
Also used : CharSource(com.google.common.io.CharSource) IncrementalIndex(io.druid.segment.incremental.IncrementalIndex) OnheapIncrementalIndex(io.druid.segment.incremental.OnheapIncrementalIndex) IncrementalIndexSegment(io.druid.segment.IncrementalIndexSegment) VersionedIntervalTimeline(io.druid.timeline.VersionedIntervalTimeline) DataSegment(io.druid.timeline.DataSegment) Segment(io.druid.segment.Segment) IncrementalIndexSegment(io.druid.segment.IncrementalIndexSegment) SingleElementPartitionChunk(io.druid.timeline.partition.SingleElementPartitionChunk) Interval(org.joda.time.Interval) BeforeClass(org.junit.BeforeClass)

Example 27 with IncrementalIndexSegment

use of io.druid.segment.IncrementalIndexSegment in project druid by druid-io.

the class TimeBoundaryQueryRunnerTest method getCustomRunner.

private QueryRunner getCustomRunner() throws IOException {
    CharSource v_0112 = CharSource.wrap(StringUtils.join(V_0112, "\n"));
    CharSource v_0113 = CharSource.wrap(StringUtils.join(V_0113, "\n"));
    IncrementalIndex index0 = TestIndex.loadIncrementalIndex(newIndex("2011-01-12T00:00:00.000Z"), v_0112);
    IncrementalIndex index1 = TestIndex.loadIncrementalIndex(newIndex("2011-01-14T00:00:00.000Z"), v_0113);
    segment0 = new IncrementalIndexSegment(index0, makeIdentifier(index0, "v1"));
    segment1 = new IncrementalIndexSegment(index1, makeIdentifier(index1, "v1"));
    VersionedIntervalTimeline<String, Segment> timeline = new VersionedIntervalTimeline(StringComparators.LEXICOGRAPHIC);
    timeline.add(index0.getInterval(), "v1", new SingleElementPartitionChunk(segment0));
    timeline.add(index1.getInterval(), "v1", new SingleElementPartitionChunk(segment1));
    segmentIdentifiers = Lists.newArrayList();
    for (TimelineObjectHolder<String, ?> holder : timeline.lookup(new Interval("2011-01-12/2011-01-17"))) {
        segmentIdentifiers.add(makeIdentifier(holder.getInterval(), holder.getVersion()));
    }
    return QueryRunnerTestHelper.makeFilteringQueryRunner(timeline, factory);
}
Also used : CharSource(com.google.common.io.CharSource) IncrementalIndex(io.druid.segment.incremental.IncrementalIndex) OnheapIncrementalIndex(io.druid.segment.incremental.OnheapIncrementalIndex) IncrementalIndexSegment(io.druid.segment.IncrementalIndexSegment) VersionedIntervalTimeline(io.druid.timeline.VersionedIntervalTimeline) DataSegment(io.druid.timeline.DataSegment) Segment(io.druid.segment.Segment) IncrementalIndexSegment(io.druid.segment.IncrementalIndexSegment) SingleElementPartitionChunk(io.druid.timeline.partition.SingleElementPartitionChunk) Interval(org.joda.time.Interval)

Aggregations

IncrementalIndexSegment (io.druid.segment.IncrementalIndexSegment)27 IncrementalIndex (io.druid.segment.incremental.IncrementalIndex)13 Result (io.druid.query.Result)11 CountAggregatorFactory (io.druid.query.aggregation.CountAggregatorFactory)10 OnheapIncrementalIndex (io.druid.segment.incremental.OnheapIncrementalIndex)10 QueryableIndexSegment (io.druid.segment.QueryableIndexSegment)9 Test (org.junit.Test)9 Row (io.druid.data.input.Row)6 QueryRunnerFactory (io.druid.query.QueryRunnerFactory)6 Segment (io.druid.segment.Segment)6 ArrayList (java.util.ArrayList)6 Interval (org.joda.time.Interval)6 Benchmark (org.openjdk.jmh.annotations.Benchmark)6 BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)6 OutputTimeUnit (org.openjdk.jmh.annotations.OutputTimeUnit)6 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)5 TimeseriesResultValue (io.druid.query.timeseries.TimeseriesResultValue)5 CharSource (com.google.common.io.CharSource)4 DefaultDimensionSpec (io.druid.query.dimension.DefaultDimensionSpec)4 GroupByQuery (io.druid.query.groupby.GroupByQuery)4