Search in sources :

Example 6 with IndexIO

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

the class AggregationTestHelper method createSelectQueryAggregationTestHelper.

public static final AggregationTestHelper createSelectQueryAggregationTestHelper(List<? extends Module> jsonModulesToRegister, TemporaryFolder tempFolder) {
    ObjectMapper mapper = new DefaultObjectMapper();
    mapper.setInjectableValues(new InjectableValues.Std().addValue(SelectQueryConfig.class, new SelectQueryConfig(true)));
    Supplier<SelectQueryConfig> configSupplier = Suppliers.ofInstance(new SelectQueryConfig(true));
    SelectQueryQueryToolChest toolchest = new SelectQueryQueryToolChest(new DefaultObjectMapper(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator(), configSupplier);
    SelectQueryRunnerFactory factory = new SelectQueryRunnerFactory(new SelectQueryQueryToolChest(new DefaultObjectMapper(), QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator(), configSupplier), new SelectQueryEngine(configSupplier), QueryRunnerTestHelper.NOOP_QUERYWATCHER);
    IndexIO indexIO = new IndexIO(mapper, new ColumnConfig() {

        @Override
        public int columnCacheSizeBytes() {
            return 0;
        }
    });
    return new AggregationTestHelper(mapper, new IndexMerger(mapper, indexIO), indexIO, toolchest, factory, tempFolder, jsonModulesToRegister);
}
Also used : IndexMerger(io.druid.segment.IndexMerger) ColumnConfig(io.druid.segment.column.ColumnConfig) SelectQueryRunnerFactory(io.druid.query.select.SelectQueryRunnerFactory) SelectQueryConfig(io.druid.query.select.SelectQueryConfig) SelectQueryQueryToolChest(io.druid.query.select.SelectQueryQueryToolChest) SelectQueryEngine(io.druid.query.select.SelectQueryEngine) IndexIO(io.druid.segment.IndexIO) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 7 with IndexIO

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

the class AggregationTestHelper method createTimeseriesQueryAggregationTestHelper.

public static final AggregationTestHelper createTimeseriesQueryAggregationTestHelper(List<? extends Module> jsonModulesToRegister, TemporaryFolder tempFolder) {
    ObjectMapper mapper = new DefaultObjectMapper();
    TimeseriesQueryQueryToolChest toolchest = new TimeseriesQueryQueryToolChest(QueryRunnerTestHelper.NoopIntervalChunkingQueryRunnerDecorator());
    TimeseriesQueryRunnerFactory factory = new TimeseriesQueryRunnerFactory(toolchest, new TimeseriesQueryEngine(), QueryRunnerTestHelper.NOOP_QUERYWATCHER);
    IndexIO indexIO = new IndexIO(mapper, new ColumnConfig() {

        @Override
        public int columnCacheSizeBytes() {
            return 0;
        }
    });
    return new AggregationTestHelper(mapper, new IndexMerger(mapper, indexIO), indexIO, toolchest, factory, tempFolder, jsonModulesToRegister);
}
Also used : IndexMerger(io.druid.segment.IndexMerger) TimeseriesQueryEngine(io.druid.query.timeseries.TimeseriesQueryEngine) TimeseriesQueryRunnerFactory(io.druid.query.timeseries.TimeseriesQueryRunnerFactory) IndexIO(io.druid.segment.IndexIO) ColumnConfig(io.druid.segment.column.ColumnConfig) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) TimeseriesQueryQueryToolChest(io.druid.query.timeseries.TimeseriesQueryQueryToolChest) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 8 with IndexIO

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

the class DumpSegment method run.

@Override
public void run() {
    final Injector injector = makeInjector();
    final IndexIO indexIO = injector.getInstance(IndexIO.class);
    final DumpType dumpType;
    try {
        dumpType = DumpType.valueOf(dumpTypeString.toUpperCase());
    } catch (Exception e) {
        throw new IAE("Not a valid dump type: %s", dumpTypeString);
    }
    try (final QueryableIndex index = indexIO.loadIndex(new File(directory))) {
        switch(dumpType) {
            case ROWS:
                runDump(injector, index);
                break;
            case METADATA:
                runMetadata(injector, index);
                break;
            case BITMAPS:
                runBitmaps(injector, index);
                break;
            default:
                throw new ISE("WTF?! dumpType[%s] has no handler?", dumpType);
        }
    } catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
Also used : IndexIO(io.druid.segment.IndexIO) Injector(com.google.inject.Injector) QueryableIndex(io.druid.segment.QueryableIndex) ISE(io.druid.java.util.common.ISE) IAE(io.druid.java.util.common.IAE) File(java.io.File) IOException(java.io.IOException)

Aggregations

IndexIO (io.druid.segment.IndexIO)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)5 ColumnConfig (io.druid.segment.column.ColumnConfig)5 IndexMerger (io.druid.segment.IndexMerger)4 File (java.io.File)4 Injector (com.google.inject.Injector)2 IAE (io.druid.java.util.common.IAE)2 QueryableIndex (io.druid.segment.QueryableIndex)2 Supplier (com.google.common.base.Supplier)1 TestUtils (io.druid.indexing.common.TestUtils)1 SegmentizerModule (io.druid.jackson.SegmentizerModule)1 ISE (io.druid.java.util.common.ISE)1 GroupByQueryRunnerFactory (io.druid.query.groupby.GroupByQueryRunnerFactory)1 SelectQueryConfig (io.druid.query.select.SelectQueryConfig)1 SelectQueryEngine (io.druid.query.select.SelectQueryEngine)1 SelectQueryQueryToolChest (io.druid.query.select.SelectQueryQueryToolChest)1 SelectQueryRunnerFactory (io.druid.query.select.SelectQueryRunnerFactory)1 TimeseriesQueryEngine (io.druid.query.timeseries.TimeseriesQueryEngine)1 TimeseriesQueryQueryToolChest (io.druid.query.timeseries.TimeseriesQueryQueryToolChest)1