Test case for map<string, string> type
@@ -49,6 +49,34 @@ public class JsonORCFileReaderWriterFactoryTest {
FileWriter fileWriter = factory.BuildFileWriter(tempLogFilePath, codec);
}
+ @Test
+ public void testMapOfStringToString() throws Exception {
+ PropertiesConfiguration properties = new PropertiesConfiguration();
+ properties.setProperty("secor.orc.schema.provider", "com.pinterest.secor.util.orc.schema.DefaultORCSchemaProvider");
+ properties.setProperty("secor.orc.message.schema.test-topic-map1", "struct<mappings:map<string\\,string>>");
+
+ SecorConfig config = new SecorConfig(properties);
+ JsonORCFileReaderWriterFactory factory = new JsonORCFileReaderWriterFactory(config);
+
+ LogFilePath tempLogFilePath = new LogFilePath(
+ Files.createTempDir().toString(),
+ "test-topic-map1",
+ new String[]{"part-1"},
+ 0, 1, 0, ".log"
+ );
+
+ FileWriter fileWriter = factory.BuildFileWriter(tempLogFilePath, codec);
+ KeyValue written1 = new KeyValue(12345, "{\"mappings\":{\"key1\":\"value1\",\"key2\":\"value2\"}}".getBytes());
+ fileWriter.write(written1);
+ fileWriter.close();
+
+ FileReader fileReader = factory.BuildFileReader(tempLogFilePath, codec);
+ KeyValue read1 = fileReader.next();
+ fileReader.close();
+
+ assertArrayEquals(read1.getValue(), written1.getValue());
+ }
+
// @Test
public void test2() throws Exception {
LogFilePath tempLogFilePath = new LogFilePath(Files.createTempDir().toString(),
