use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator in project debezium by debezium.
the class JacksonWriter method write.
@Override
public String write(Document document) throws IOException {
StringWriter writer = new StringWriter();
try (JsonGenerator jsonGenerator = factory.createGenerator(writer)) {
configure(jsonGenerator);
writeDocument(document, jsonGenerator);
}
return writer.getBuffer().toString();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator in project debezium by debezium.
the class JacksonWriter method write.
@Override
public void write(Array array, OutputStream jsonStream) throws IOException {
try (JsonGenerator jsonGenerator = factory.createGenerator(jsonStream)) {
configure(jsonGenerator);
writeArray(array, jsonGenerator);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator in project credhub by cloudfoundry-incubator.
the class TimeModuleFactory method createTimeModule.
public static JavaTimeModule createTimeModule() {
JavaTimeModule javaTimeModule = new JavaTimeModule();
javaTimeModule.addSerializer(Instant.class, new JsonSerializer<Instant>() {
@Override
public void serialize(Instant value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeString(ZonedDateTime.ofInstant(value, ZoneId.of("UTC")).format(TIMESTAMP_FORMAT));
}
});
return javaTimeModule;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator in project calcite by apache.
the class DruidQueryFilterTest method testInFilter.
@Test
public void testInFilter() throws IOException {
final Fixture f = new Fixture();
final List<? extends RexNode> listRexNodes = ImmutableList.of(f.rexBuilder.makeInputRef(f.varcharRowType, 0), f.rexBuilder.makeExactLiteral(BigDecimal.valueOf(1)), f.rexBuilder.makeExactLiteral(BigDecimal.valueOf(5)), f.rexBuilder.makeLiteral("value1"));
RexNode inRexNode = f.rexBuilder.makeCall(SqlStdOperatorTable.IN, listRexNodes);
DruidJsonFilter returnValue = DruidJsonFilter.toDruidFilters(inRexNode, f.varcharRowType, druidQuery);
Assert.assertNotNull("Filter is null", returnValue);
JsonFactory jsonFactory = new JsonFactory();
final StringWriter sw = new StringWriter();
JsonGenerator jsonGenerator = jsonFactory.createGenerator(sw);
returnValue.write(jsonGenerator);
jsonGenerator.close();
Assert.assertThat(sw.toString(), is("{\"type\":\"in\",\"dimension\":\"dimensionName\"," + "\"values\":[\"1\",\"5\",\"value1\"]}"));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator in project calcite by apache.
the class DruidQueryFilterTest method testBetweenFilterStringCase.
@Test
public void testBetweenFilterStringCase() throws IOException {
final Fixture f = new Fixture();
final List<RexNode> listRexNodes = ImmutableList.of(f.rexBuilder.makeLiteral(false), f.rexBuilder.makeInputRef(f.varcharRowType, 0), f.rexBuilder.makeLiteral("lower-bound"), f.rexBuilder.makeLiteral("upper-bound"));
RelDataType relDataType = f.typeFactory.createSqlType(SqlTypeName.BOOLEAN);
RexNode betweenRexNode = f.rexBuilder.makeCall(relDataType, SqlStdOperatorTable.BETWEEN, listRexNodes);
DruidJsonFilter returnValue = DruidJsonFilter.toDruidFilters(betweenRexNode, f.varcharRowType, druidQuery);
Assert.assertNotNull("Filter is null", returnValue);
JsonFactory jsonFactory = new JsonFactory();
final StringWriter sw = new StringWriter();
JsonGenerator jsonGenerator = jsonFactory.createGenerator(sw);
returnValue.write(jsonGenerator);
jsonGenerator.close();
Assert.assertThat(sw.toString(), is("{\"type\":\"bound\",\"dimension\":\"dimensionName\",\"lower\":\"lower-bound\"," + "\"lowerStrict\":false,\"upper\":\"upper-bound\",\"upperStrict\":false," + "\"ordering\":\"lexicographic\"}"));
}
Aggregations