Search in sources :

Example 31 with SmileFactory

use of com.fasterxml.jackson.dataformat.smile.SmileFactory in project druid by druid-io.

the class BrokerServerViewTest method getSmileMapper.

public ObjectMapper getSmileMapper() {
    final SmileFactory smileFactory = new SmileFactory();
    smileFactory.configure(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT, false);
    smileFactory.delegateToTextual(true);
    final ObjectMapper retVal = new DefaultObjectMapper(smileFactory);
    retVal.getFactory().setCodec(retVal);
    return retVal;
}
Also used : SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper)

Example 32 with SmileFactory

use of com.fasterxml.jackson.dataformat.smile.SmileFactory in project druid by druid-io.

the class CachingClusteredClientTestUtils method createObjectMapper.

public static ObjectMapper createObjectMapper() {
    final SmileFactory factory = new SmileFactory();
    final ObjectMapper objectMapper = new DefaultObjectMapper(factory);
    factory.setCodec(objectMapper);
    return objectMapper;
}
Also used : SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper)

Example 33 with SmileFactory

use of com.fasterxml.jackson.dataformat.smile.SmileFactory in project druid by druid-io.

the class SqlFirehoseTest method setup.

@Before
public void setup() throws IOException {
    TEST_DIR = File.createTempFile(SqlFirehose.class.getSimpleName(), "testDir");
    org.apache.commons.io.FileUtils.forceDelete(TEST_DIR);
    FileUtils.mkdirp(TEST_DIR);
    final List<Map<String, Object>> inputTexts = ImmutableList.of(ImmutableMap.of("x", "foostring1", "timestamp", 2000), ImmutableMap.of("x", "foostring2", "timestamp", 2000));
    List<FileInputStream> testFile = new ArrayList<>();
    this.objectMapper = new ObjectMapper(new SmileFactory());
    int i = 0;
    for (Map m : inputTexts) {
        File file = new File(TEST_DIR, "test_" + i++);
        try (FileOutputStream fos = new FileOutputStream(file)) {
            final JsonGenerator jg = objectMapper.getFactory().createGenerator(fos);
            jg.writeStartArray();
            jg.writeObject(m);
            jg.writeEndArray();
            jg.close();
            testFile.add(new FileInputStream(file));
        }
    }
    this.fileList = testFile;
    parser = TransformSpec.NONE.decorate(new MapInputRowParser(new TimeAndDimsParseSpec(new TimestampSpec("timestamp", "auto", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("x"))))));
    this.inputs = inputTexts;
}
Also used : MapInputRowParser(org.apache.druid.data.input.impl.MapInputRowParser) ArrayList(java.util.ArrayList) FileInputStream(java.io.FileInputStream) TimeAndDimsParseSpec(org.apache.druid.data.input.impl.TimeAndDimsParseSpec) SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) FileOutputStream(java.io.FileOutputStream) TimestampSpec(org.apache.druid.data.input.impl.TimestampSpec) JsonGenerator(com.fasterxml.jackson.core.JsonGenerator) DimensionsSpec(org.apache.druid.data.input.impl.DimensionsSpec) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) File(java.io.File) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 34 with SmileFactory

use of com.fasterxml.jackson.dataformat.smile.SmileFactory in project spring-framework by spring-projects.

the class Jackson2ObjectMapperBuilderTests method factory.

// SPR-14435
@Test
void factory() {
    ObjectMapper objectMapper = new Jackson2ObjectMapperBuilder().factory(new SmileFactory()).build();
    assertThat(objectMapper).isNotNull();
    assertThat(objectMapper.getFactory().getClass()).isEqualTo(SmileFactory.class);
}
Also used : SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.jupiter.api.Test)

Aggregations

SmileFactory (com.fasterxml.jackson.dataformat.smile.SmileFactory)34 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)24 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)10 ByteBuffer (java.nio.ByteBuffer)8 DruidProcessingConfig (org.apache.druid.query.DruidProcessingConfig)6 GroupByStrategySelector (org.apache.druid.query.groupby.strategy.GroupByStrategySelector)6 GroupByStrategyV1 (org.apache.druid.query.groupby.strategy.GroupByStrategyV1)6 GroupByStrategyV2 (org.apache.druid.query.groupby.strategy.GroupByStrategyV2)6 Before (org.junit.Before)6 File (java.io.File)5 BasicAuthCommonCacheConfig (org.apache.druid.security.basic.BasicAuthCommonCacheConfig)5 Setup (org.openjdk.jmh.annotations.Setup)5 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)4 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)4 MetadataStorageTablesConfig (org.apache.druid.metadata.MetadataStorageTablesConfig)4 TestDerbyConnector (org.apache.druid.metadata.TestDerbyConnector)4 InputRow (io.druid.data.input.InputRow)3 DefaultBlockingPool (org.apache.druid.collections.DefaultBlockingPool)3 StupidPool (org.apache.druid.collections.StupidPool)3 BasicRoleBasedAuthorizer (org.apache.druid.security.basic.authorization.BasicRoleBasedAuthorizer)3