Search in sources :

Example 6 with IndexMergerV9

use of org.apache.druid.segment.IndexMergerV9 in project druid by druid-io.

the class IndexMergeBenchmark method setup.

@Setup
public void setup() throws IOException {
    log.info("SETUP CALLED AT " + System.currentTimeMillis());
    indexMergerV9 = new IndexMergerV9(JSON_MAPPER, INDEX_IO, getSegmentWriteOutMediumFactory(factoryType));
    ComplexMetrics.registerSerde("hyperUnique", new HyperUniquesSerde());
    indexesToMerge = new ArrayList<>();
    schemaInfo = GeneratorBasicSchemas.SCHEMA_MAP.get(schema);
    for (int i = 0; i < numSegments; i++) {
        DataGenerator gen = new DataGenerator(schemaInfo.getColumnSchemas(), RNG_SEED + i, schemaInfo.getDataInterval(), rowsPerSegment);
        IncrementalIndex incIndex = makeIncIndex();
        gen.addToIndex(incIndex, rowsPerSegment);
        tmpDir = FileUtils.createTempDir();
        log.info("Using temp dir: " + tmpDir.getAbsolutePath());
        File indexFile = indexMergerV9.persist(incIndex, tmpDir, new IndexSpec(), null);
        QueryableIndex qIndex = INDEX_IO.loadIndex(indexFile);
        indexesToMerge.add(qIndex);
    }
}
Also used : IndexSpec(org.apache.druid.segment.IndexSpec) IncrementalIndex(org.apache.druid.segment.incremental.IncrementalIndex) OnheapIncrementalIndex(org.apache.druid.segment.incremental.OnheapIncrementalIndex) QueryableIndex(org.apache.druid.segment.QueryableIndex) IndexMergerV9(org.apache.druid.segment.IndexMergerV9) DataGenerator(org.apache.druid.segment.generator.DataGenerator) HyperUniquesSerde(org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde) File(java.io.File) Setup(org.openjdk.jmh.annotations.Setup)

Example 7 with IndexMergerV9

use of org.apache.druid.segment.IndexMergerV9 in project druid by druid-io.

the class AggregationTestHelper method createTopNQueryAggregationTestHelper.

public static AggregationTestHelper createTopNQueryAggregationTestHelper(List<? extends Module> jsonModulesToRegister, TemporaryFolder tempFolder) {
    ObjectMapper mapper = TestHelper.makeJsonMapper();
    TopNQueryQueryToolChest toolchest = new TopNQueryQueryToolChest(new TopNQueryConfig());
    final CloseableStupidPool<ByteBuffer> pool = new CloseableStupidPool<>("TopNQueryRunnerFactory-bufferPool", new Supplier<ByteBuffer>() {

        @Override
        public ByteBuffer get() {
            return ByteBuffer.allocate(10 * 1024 * 1024);
        }
    });
    final Closer resourceCloser = Closer.create();
    TopNQueryRunnerFactory factory = new TopNQueryRunnerFactory(pool, toolchest, QueryRunnerTestHelper.NOOP_QUERYWATCHER);
    IndexIO indexIO = new IndexIO(mapper, new ColumnConfig() {

        @Override
        public int columnCacheSizeBytes() {
            return 0;
        }
    });
    return new AggregationTestHelper(mapper, new IndexMergerV9(mapper, indexIO, OffHeapMemorySegmentWriteOutMediumFactory.instance()), indexIO, toolchest, factory, tempFolder, jsonModulesToRegister, resourceCloser, Collections.emptyMap());
}
Also used : Closer(org.apache.druid.java.util.common.io.Closer) ColumnConfig(org.apache.druid.segment.column.ColumnConfig) IndexMergerV9(org.apache.druid.segment.IndexMergerV9) CloseableStupidPool(org.apache.druid.collections.CloseableStupidPool) ByteBuffer(java.nio.ByteBuffer) TopNQueryConfig(org.apache.druid.query.topn.TopNQueryConfig) IndexIO(org.apache.druid.segment.IndexIO) TopNQueryRunnerFactory(org.apache.druid.query.topn.TopNQueryRunnerFactory) TopNQueryQueryToolChest(org.apache.druid.query.topn.TopNQueryQueryToolChest) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 8 with IndexMergerV9

use of org.apache.druid.segment.IndexMergerV9 in project druid by druid-io.

the class AggregationTestHelper method createScanQueryAggregationTestHelper.

public static AggregationTestHelper createScanQueryAggregationTestHelper(List<? extends Module> jsonModulesToRegister, TemporaryFolder tempFolder) {
    ObjectMapper mapper = TestHelper.makeJsonMapper();
    ScanQueryQueryToolChest toolchest = new ScanQueryQueryToolChest(new ScanQueryConfig(), DefaultGenericQueryMetricsFactory.instance());
    final Closer resourceCloser = Closer.create();
    ScanQueryRunnerFactory factory = new ScanQueryRunnerFactory(toolchest, new ScanQueryEngine(), new ScanQueryConfig());
    IndexIO indexIO = new IndexIO(mapper, new ColumnConfig() {

        @Override
        public int columnCacheSizeBytes() {
            return 0;
        }
    });
    return new AggregationTestHelper(mapper, new IndexMergerV9(mapper, indexIO, OffHeapMemorySegmentWriteOutMediumFactory.instance()), indexIO, toolchest, factory, tempFolder, jsonModulesToRegister, resourceCloser, Collections.emptyMap());
}
Also used : Closer(org.apache.druid.java.util.common.io.Closer) ScanQueryConfig(org.apache.druid.query.scan.ScanQueryConfig) ScanQueryQueryToolChest(org.apache.druid.query.scan.ScanQueryQueryToolChest) IndexIO(org.apache.druid.segment.IndexIO) ColumnConfig(org.apache.druid.segment.column.ColumnConfig) IndexMergerV9(org.apache.druid.segment.IndexMergerV9) ScanQueryEngine(org.apache.druid.query.scan.ScanQueryEngine) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ScanQueryRunnerFactory(org.apache.druid.query.scan.ScanQueryRunnerFactory)

Aggregations

IndexMergerV9 (org.apache.druid.segment.IndexMergerV9)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 IndexIO (org.apache.druid.segment.IndexIO)6 File (java.io.File)4 IndexSpec (org.apache.druid.segment.IndexSpec)4 ColumnConfig (org.apache.druid.segment.column.ColumnConfig)4 Closer (org.apache.druid.java.util.common.io.Closer)3 IndexMerger (org.apache.druid.segment.IndexMerger)3 IncrementalIndex (org.apache.druid.segment.incremental.IncrementalIndex)3 DataSegment (org.apache.druid.timeline.DataSegment)3 InjectableValues (com.fasterxml.jackson.databind.InjectableValues)2 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)2 SegmentizerModule (org.apache.druid.jackson.SegmentizerModule)2 ExprMacroTable (org.apache.druid.math.expr.ExprMacroTable)2 TestExprMacroTable (org.apache.druid.query.expression.TestExprMacroTable)2 SegmentizerFactory (org.apache.druid.segment.loading.SegmentizerFactory)2 Interval (org.joda.time.Interval)2 ByteBuffer (java.nio.ByteBuffer)1 CloseableStupidPool (org.apache.druid.collections.CloseableStupidPool)1 HyperUniquesSerde (org.apache.druid.query.aggregation.hyperloglog.HyperUniquesSerde)1