Zkplo commented on code in PR #10970:
URL: https://github.com/apache/inlong/pull/10970#discussion_r1740281981


##########
inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformArithmeticFunctionsProcessor.java:
##########
@@ -257,6 +257,179 @@ public void testMd5Function() throws Exception {
         Assert.assertEquals("result=null", output4.get(0));
     }
 
+    @Test
+    public void testBitwiseInversionOperator() throws Exception {
+        String transformSql = null, data = null;
+        TransformConfig config = null;
+        TransformProcessor<String, String> processor = null;
+        List<String> output = null;
+
+        // case1: ~-4
+        transformSql = "select ~numeric1 from source";
+        config = new TransformConfig(transformSql);
+        processor = TransformProcessor
+                .create(config, 
SourceDecoderFactory.createCsvDecoder(csvSource),
+                        SinkEncoderFactory.createKvEncoder(kvSink));
+        data = "-4|3|3";
+        output = processor.transform(data, new HashMap<>());
+        Assert.assertEquals(1, output.size());
+        Assert.assertEquals("result=3", output.get(0));
+
+        // case2: ~4
+        transformSql = "select ~numeric1 from source";
+        config = new TransformConfig(transformSql);
+        processor = TransformProcessor
+                .create(config, 
SourceDecoderFactory.createCsvDecoder(csvSource),
+                        SinkEncoderFactory.createKvEncoder(kvSink));
+        data = "4|3|3";
+        output = processor.transform(data, new HashMap<>());
+        Assert.assertEquals(1, output.size());
+        Assert.assertEquals("result=18446744073709551611", output.get(0));

Review Comment:
   As explained below, "~~-4" is no longer equal to "-4", it will be equal to 
"1844674407909551612". And added its test cases, please check.



-- 
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

Reply via email to