aloyszhang commented on code in PR #10155: URL: https://github.com/apache/inlong/pull/10155#discussion_r1593869126
########## inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformProcessor.java: ########## @@ -71,6 +71,28 @@ public void testCsv2Kv() { } } + @Test + public void testCsv2KvNoField() { + try { + SourceInfo csvSource = new CsvSourceInfo("UTF-8", "|", "\\", null); + SinkInfo kvSink = new KvSinkInfo("UTF-8", null); + String transformSql = "select $1 ftime,$2 extinfo from source where $2='ok'"; + TransformConfig config = new TransformConfig(csvSource, kvSink, transformSql); + // case1 + TransformProcessor processor1 = new TransformProcessor(config); + List<String> output1 = processor1.transform("2024-04-28 00:00:00|ok", new HashMap<>()); + Assert.assertTrue(output1.size() == 1); + Assert.assertEquals(output1.get(0), "ftime=2024-04-28 00:00:00&extinfo=ok"); + // case2 + config.setTransformSql("select $1 ftime,$2 extinfo from source where $2!='ok'"); + TransformProcessor processor2 = new TransformProcessor(config); + List<String> output2 = processor2.transform("2024-04-28 00:00:00|ok", new HashMap<>()); + Assert.assertTrue(output2.size() == 0); + } catch (Exception e) { + e.printStackTrace(); + } Review Comment: No need to catch exceptions here, otherwise the test will never fail in workflow. -- 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. To unsubscribe, e-mail: commits-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org