libenchao commented on a change in pull request #11180: [FLINK-16220][json] Fix JsonRowSerializationSchema cast exception due… URL: https://github.com/apache/flink/pull/11180#discussion_r394782478
########## File path: flink-formats/flink-json/src/test/java/org/apache/flink/formats/json/JsonRowSerializationSchemaTest.java ########## @@ -91,20 +91,51 @@ public void testSerializationOfTwoRows() throws IOException { assertEquals(row2, deserializationSchema.deserialize(bytes)); } + @Test + public void testMultiRowsWithNullValues() throws IOException { + String[] jsons = new String[] { + "{\"svt\":\"2020-02-24T12:58:09.209+0800\"}", + "{\"svt\":\"2020-02-24T12:58:09.209+0800\", \"ops\":{\"id\":\"281708d0-4092-4c21-9233-931950b6eccf\"}}", + "{\"svt\":\"2020-02-24T12:58:09.209+0800\"}", + }; + + String[] expected = new String[] { + "{\"svt\":\"2020-02-24T12:58:09.209+0800\",\"ops\":null}", + "{\"svt\":\"2020-02-24T12:58:09.209+0800\",\"ops\":{\"id\":\"281708d0-4092-4c21-9233-931950b6eccf\"}}", + "{\"svt\":\"2020-02-24T12:58:09.209+0800\",\"ops\":null}", + }; + + TypeInformation<Row> schema = Types.ROW_NAMED( + new String[]{"svt", "ops"}, + Types.STRING, + Types.ROW_NAMED(new String[]{"id"}, Types.STRING)); Review comment: Done ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services