@JsonCreator public NoopInputRowParser( @JsonProperty("parseSpec") ParseSpec parseSpec ) { this.parseSpec = parseSpec != null ? parseSpec : new TimeAndDimsParseSpec(null, null); }
@Override public ParseSpec withTimestampSpec(TimestampSpec spec) { return new TimeAndDimsParseSpec(spec, getDimensionsSpec()); }
@Override public ParseSpec withDimensionsSpec(DimensionsSpec spec) { return new TimeAndDimsParseSpec(getTimestampSpec(), spec); } }
@Test public void testSerdeWithNulls() throws Exception { String jsonStr = "{ \"format\":\"timeAndDims\" }"; ParseSpec actual = mapper.readValue( mapper.writeValueAsString( mapper.readValue(jsonStr, ParseSpec.class) ), ParseSpec.class ); Assert.assertEquals(new TimeAndDimsParseSpec(null, null), actual); }
@Override public ParseSpec withDimensionsSpec(DimensionsSpec spec) { return new TimeAndDimsParseSpec(getTimestampSpec(), spec); } }
@Override public ParseSpec withTimestampSpec(TimestampSpec spec) { return new TimeAndDimsParseSpec(spec, getDimensionsSpec()); }
? createMetricsSpec(queryableIndexAndSegments) : convertToCombiningFactories(metricsSpec); final InputRowParser parser = new NoopInputRowParser(new TimeAndDimsParseSpec(null, finalDimensionsSpec));
public static List<InputRow> inputRowsWithDimensions(final List<String> dimensions) { final MapInputRowParser parser = new MapInputRowParser( new TimeAndDimsParseSpec( new TimestampSpec(TIMESTAMP_COLUMN, "iso", null), new DimensionsSpec( DimensionsSpec.getDefaultSchemas(dimensions), dimensions.isEmpty() ? ImmutableList.of("t", "c1", "c2") : null, null ) ) ); return ImmutableList.of( parser.parseBatch(ImmutableMap.of("t", "2000-01-01", "c1", "9", "c2", ImmutableList.of("a"))).get(0), parser.parseBatch(ImmutableMap.of("t", "2000-01-02", "c1", "10.1", "c2", ImmutableList.of())).get(0), parser.parseBatch(ImmutableMap.of("t", "2000-01-03", "c1", "2", "c2", ImmutableList.of(""))).get(0), parser.parseBatch(ImmutableMap.of("t", "2001-01-01", "c1", "1", "c2", ImmutableList.of("a", "c"))).get(0), parser.parseBatch(ImmutableMap.of("t", "2001-01-02", "c1", "4", "c2", ImmutableList.of("abc"))).get(0), parser.parseBatch(ImmutableMap.of("t", "2001-01-03", "c1", "5")).get(0) ); }
new TimeAndDimsParseSpec( new TimestampSpec("timestamp", "auto", null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("x")), null, null)
@Test public void testSerdeWithNonNullParseSpec() throws Exception { String jsonStr = "{" + "\"type\":\"noop\"," + "\"parseSpec\":{ \"format\":\"timeAndDims\", \"dimensionsSpec\": { \"dimensions\": [\"host\"] } }" + "}"; InputRowParser actual = mapper.readValue( mapper.writeValueAsString( mapper.readValue(jsonStr, InputRowParser.class) ), InputRowParser.class ); Assert.assertEquals( new NoopInputRowParser( new TimeAndDimsParseSpec( null, new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host")), null, null) ) ), actual ); } }
@Test public void testSerdeWithNonNulls() throws Exception { String jsonStr = "{" + "\"format\":\"timeAndDims\"," + "\"timestampSpec\": { \"column\": \"tcol\" }," + "\"dimensionsSpec\": { \"dimensions\": [\"host\"] }" + "}"; ParseSpec actual = mapper.readValue( mapper.writeValueAsString( mapper.readValue(jsonStr, ParseSpec.class) ), ParseSpec.class ); Assert.assertEquals( new TimeAndDimsParseSpec( new TimestampSpec("tcol", null, null), new DimensionsSpec(DimensionsSpec.getDefaultSchemas(ImmutableList.of("host")), null, null) ), actual ); } }
TestHelper.makeJsonMapper().convertValue( new MapInputRowParser( new TimeAndDimsParseSpec( new TimestampSpec("t", "auto", null), new DimensionsSpec(
private static class TestFirehoseFactory implements FirehoseFactory<InputRowParser> { public TestFirehoseFactory() { } @Override @SuppressWarnings("unchecked") public Firehose connect(InputRowParser parser, File temporaryDirectory) throws ParseException { return new TestFirehose(parser); } }
@JsonCreator public NoopInputRowParser( @JsonProperty("parseSpec") ParseSpec parseSpec ) { this.parseSpec = parseSpec != null ? parseSpec : new TimeAndDimsParseSpec(null, null); }
createDimensionsSpec(queryableIndexAndSegments) : dimensionsSpec; final InputRowParser parser = new NoopInputRowParser(new TimeAndDimsParseSpec(null, finalDimensionsSpec));