Search in sources :

Example 6 with ColumnConfig

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

the class SegmentizerFactoryTest method testFactory.

@Test
public void testFactory() throws IOException {
    File factoryFile = Files.createTempFile("", "factory.json").toFile();
    FileOutputStream fos = new FileOutputStream(factoryFile);
    ObjectMapper mapper = new DefaultObjectMapper();
    mapper.registerModule(new SegmentizerModule());
    IndexIO indexIO = new IndexIO(mapper, new ColumnConfig() {

        @Override
        public int columnCacheSizeBytes() {
            return 777;
        }
    });
    mapper.setInjectableValues(new InjectableValues.Std().addValue(IndexIO.class, indexIO));
    mapper.writeValue(fos, new MMappedQueryableSegmentizerFactory(indexIO));
    fos.close();
    SegmentizerFactory factory = mapper.readValue(factoryFile, SegmentizerFactory.class);
    Assert.assertTrue(factory instanceof MMappedQueryableSegmentizerFactory);
}
Also used : IndexIO(org.apache.druid.segment.IndexIO) ColumnConfig(org.apache.druid.segment.column.ColumnConfig) FileOutputStream(java.io.FileOutputStream) SegmentizerModule(org.apache.druid.jackson.SegmentizerModule) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) File(java.io.File) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Test(org.junit.Test)

Example 7 with ColumnConfig

use of org.apache.druid.segment.column.ColumnConfig 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 ColumnConfig

use of org.apache.druid.segment.column.ColumnConfig 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

ColumnConfig (org.apache.druid.segment.column.ColumnConfig)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 IndexIO (org.apache.druid.segment.IndexIO)5 IndexMergerV9 (org.apache.druid.segment.IndexMergerV9)4 ByteBuffer (java.nio.ByteBuffer)3 Closer (org.apache.druid.java.util.common.io.Closer)3 ColumnBuilder (org.apache.druid.segment.column.ColumnBuilder)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 Optional (java.util.Optional)1 Set (java.util.Set)1 CloseableStupidPool (org.apache.druid.collections.CloseableStupidPool)1 ImmutableBitmap (org.apache.druid.collections.bitmap.ImmutableBitmap)1 ImmutableRTree (org.apache.druid.collections.spatial.ImmutableRTree)1 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)1 SegmentizerModule (org.apache.druid.jackson.SegmentizerModule)1 IAE (org.apache.druid.java.util.common.IAE)1 ExprMacroTable (org.apache.druid.math.expr.ExprMacroTable)1 LookupExprMacro (org.apache.druid.query.expression.LookupExprMacro)1