Search in sources :

Example 6 with StringDimensionSchema

use of io.druid.data.input.impl.StringDimensionSchema in project druid by druid-io.

the class OrcHadoopInputRowParserTest method testSerde.

@Test
public void testSerde() throws IOException {
    String parserString = "{\n" + "        \"type\": \"orc\",\n" + "        \"parseSpec\": {\n" + "          \"format\": \"timeAndDims\",\n" + "          \"timestampSpec\": {\n" + "            \"column\": \"timestamp\",\n" + "            \"format\": \"auto\"\n" + "          },\n" + "          \"dimensionsSpec\": {\n" + "            \"dimensions\": [\n" + "              \"col1\",\n" + "              \"col2\"\n" + "            ],\n" + "            \"dimensionExclusions\": [],\n" + "            \"spatialDimensions\": []\n" + "          }\n" + "        },\n" + "        \"typeString\": \"struct<timestamp:string,col1:string,col2:array<string>,val1:float>\"\n" + "      }";
    InputRowParser parser = mapper.readValue(parserString, InputRowParser.class);
    InputRowParser expected = new OrcHadoopInputRowParser(new TimeAndDimsParseSpec(new TimestampSpec("timestamp", "auto", null), new DimensionsSpec(ImmutableList.<DimensionSchema>of(new StringDimensionSchema("col1"), new StringDimensionSchema("col2")), null, null)), "struct<timestamp:string,col1:string,col2:array<string>,val1:float>");
    Assert.assertEquals(expected, parser);
}
Also used : TimeAndDimsParseSpec(io.druid.data.input.impl.TimeAndDimsParseSpec) TimestampSpec(io.druid.data.input.impl.TimestampSpec) DimensionsSpec(io.druid.data.input.impl.DimensionsSpec) InputRowParser(io.druid.data.input.impl.InputRowParser) StringDimensionSchema(io.druid.data.input.impl.StringDimensionSchema) Test(org.junit.Test)

Aggregations

StringDimensionSchema (io.druid.data.input.impl.StringDimensionSchema)6 DimensionsSpec (io.druid.data.input.impl.DimensionsSpec)5 MapBasedInputRow (io.druid.data.input.MapBasedInputRow)3 TimestampSpec (io.druid.data.input.impl.TimestampSpec)3 Test (org.junit.Test)3 DimensionSchema (io.druid.data.input.impl.DimensionSchema)2 TimeAndDimsParseSpec (io.druid.data.input.impl.TimeAndDimsParseSpec)2 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)2 IncrementalIndex (io.druid.segment.incremental.IncrementalIndex)2 OnheapIncrementalIndex (io.druid.segment.incremental.OnheapIncrementalIndex)2 Function (com.google.common.base.Function)1 StupidPool (io.druid.collections.StupidPool)1 MapBasedRow (io.druid.data.input.MapBasedRow)1 Row (io.druid.data.input.Row)1 FloatDimensionSchema (io.druid.data.input.impl.FloatDimensionSchema)1 InputRowParser (io.druid.data.input.impl.InputRowParser)1 LongDimensionSchema (io.druid.data.input.impl.LongDimensionSchema)1 ParseSpec (io.druid.data.input.impl.ParseSpec)1 ISE (io.druid.java.util.common.ISE)1 Pair (io.druid.java.util.common.Pair)1