use of org.apache.inlong.sort.formats.common.IntFormatInfo in project incubator-inlong by apache.
the class RowToDebeziumJsonKafkaSinkTest method prepareData.
@Override
protected void prepareData() throws IOException, ClassNotFoundException {
topic = "test_kafka_row_to_debezium";
fieldInfos = new FieldInfo[] { new FieldInfo("f1", new StringFormatInfo()), new FieldInfo("f2", new IntFormatInfo()) };
serializationSchema = SerializationSchemaFactory.build(fieldInfos, new DebeziumSerializationInfo("sql", "literal", "null", true));
prepareTestData();
}
use of org.apache.inlong.sort.formats.common.IntFormatInfo in project incubator-inlong by apache.
the class RowToJsonKafkaSinkTest method prepareData.
@Override
protected void prepareData() throws IOException, ClassNotFoundException {
topic = "test_kafka_row_to_json";
serializationSchema = SerializationSchemaFactory.build(new FieldInfo[] { new FieldInfo("f1", new StringFormatInfo()), new FieldInfo("f2", new MapFormatInfo(new StringFormatInfo(), new DoubleFormatInfo())), new FieldInfo("f3", new ArrayFormatInfo(new IntFormatInfo())) }, new JsonSerializationInfo());
prepareTestRows();
}
use of org.apache.inlong.sort.formats.common.IntFormatInfo in project incubator-inlong by apache.
the class CommonUtilsTest method testBuildAvroRecordSchemaInJsonForRecursiveFields.
@Test
public void testBuildAvroRecordSchemaInJsonForRecursiveFields() throws IOException {
FieldInfo[] testFieldInfos = new FieldInfo[] { new FieldInfo("f1", new ArrayFormatInfo(new MapFormatInfo(new StringFormatInfo(), new ArrayFormatInfo(new ArrayFormatInfo(new ShortFormatInfo()))))), new FieldInfo("f2", new MapFormatInfo(new StringFormatInfo(), new MapFormatInfo(new StringFormatInfo(), new RowFormatInfo(new String[] { "f21", "f22" }, new FormatInfo[] { new IntFormatInfo(), new ArrayFormatInfo(new ByteFormatInfo()) })))), new FieldInfo("f3", new RowFormatInfo(new String[] { "f31", "f32" }, new FormatInfo[] { new ArrayFormatInfo(new StringFormatInfo()), new RowFormatInfo(new String[] { "f321", "f322" }, new FormatInfo[] { new ArrayFormatInfo(new IntFormatInfo()), new MapFormatInfo(new StringFormatInfo(), new ArrayFormatInfo(new ByteFormatInfo())) }) })) };
JsonNode expectedJsonNode = objectMapper.readTree("{\n" + " \"type\":\"record\",\n" + " \"name\":\"record\",\n" + " \"fields\":[\n" + " {\n" + " \"name\":\"f1\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"array\",\n" + " \"items\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"map\",\n" + " \"values\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"array\",\n" + " \"items\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"array\",\n" + " \"items\":[\n" + " \"null\",\n" + " \"int\"\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " },\n" + " {\n" + " \"name\":\"f2\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"map\",\n" + " \"values\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"map\",\n" + " \"values\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"record\",\n" + " \"name\":\"record_f2\",\n" + " \"fields\":[\n" + " {\n" + " \"name\":\"f21\",\n" + " \"type\":[\n" + " \"null\",\n" + " \"int\"\n" + " ],\n" + " \"default\":null\n" + " },\n" + " {\n" + " \"name\":\"f22\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"array\",\n" + " \"items\":[\n" + " \"null\",\n" + " \"int\"\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " },\n" + " {\n" + " \"name\":\"f3\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"record\",\n" + " \"name\":\"record_f3\",\n" + " \"fields\":[\n" + " {\n" + " \"name\":\"f31\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"array\",\n" + " \"items\":[\n" + " \"null\",\n" + " \"string\"\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " },\n" + " {\n" + " \"name\":\"f32\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"record\",\n" + " \"name\":\"record_f3_f32\",\n" + " \"fields\":[\n" + " {\n" + " \"name\":\"f321\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"array\",\n" + " \"items\":[\n" + " \"null\",\n" + " \"int\"\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " },\n" + " {\n" + " \"name\":\"f322\",\n" + " \"type\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"map\",\n" + " \"values\":[\n" + " \"null\",\n" + " {\n" + " \"type\":\"array\",\n" + " \"items\":[\n" + " \"null\",\n" + " \"int\"\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " }\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " }\n" + " ]\n" + " }\n" + " ],\n" + " \"default\":null\n" + " }\n" + " ]\n" + "}");
String actualJson = buildAvroRecordSchemaInJson(testFieldInfos);
JsonNode actualJsonNode = objectMapper.readTree(actualJson);
assertEquals(expectedJsonNode, actualJsonNode);
}
use of org.apache.inlong.sort.formats.common.IntFormatInfo in project incubator-inlong by apache.
the class RowToAvroKafkaSinkTest method prepareData.
@Override
protected void prepareData() throws IOException, ClassNotFoundException {
fieldInfos = new FieldInfo[] { new FieldInfo("f1", new StringFormatInfo()), new FieldInfo("f2", new IntFormatInfo()), new FieldInfo("f3", new NullFormatInfo()), new FieldInfo("f4", new BinaryFormatInfo()), new FieldInfo("f5", new MapFormatInfo(new StringFormatInfo(), new RowFormatInfo(new String[] { "f51", "f52" }, new FormatInfo[] { new IntFormatInfo(), new ArrayFormatInfo(new DoubleFormatInfo()) }))) };
topic = "test_kafka_row_to_avro";
serializationSchema = SerializationSchemaFactory.build(fieldInfos, new AvroSerializationInfo());
prepareTestRows();
}
use of org.apache.inlong.sort.formats.common.IntFormatInfo in project incubator-inlong by apache.
the class RowToCanalKafkaSinkTest method prepareData.
@Override
protected void prepareData() throws IOException, ClassNotFoundException {
topic = "test_kafka_row_to_canal";
fieldInfos = new FieldInfo[] { new FieldInfo("f1", new StringFormatInfo()), new FieldInfo("f2", new IntFormatInfo()) };
serializationSchema = SerializationSchemaFactory.build(fieldInfos, new CanalSerializationInfo());
prepareTestData();
}
Aggregations