lmagic233 commented on a change in pull request #14604:
URL: https://github.com/apache/flink/pull/14604#discussion_r556286068



##########
File path: 
flink-formats/flink-json/src/test/java/org/apache/flink/formats/json/JsonRowDataSerDeSchemaTest.java
##########
@@ -562,6 +579,56 @@ public void testSerializationMapNullKey() throws Exception 
{
         assertEquals(expectResult3, new String(actual3));
     }
 
+    @Test
+    public void testSerializationDecimalEncode() throws Exception {
+        BigDecimal decimal1 = new BigDecimal("123.456789");
+        BigDecimal decimal2 = new BigDecimal("454621864049246170");
+        BigDecimal decimal3 = new BigDecimal("0.000000027");
+
+        ObjectMapper objectMapper = new ObjectMapper();
+        
objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
+
+        ObjectNode root = objectMapper.createObjectNode();
+        root.put("decimal1", decimal1);
+        root.put("decimal2", decimal2);
+        root.put("decimal3", decimal3);
+
+        byte[] serializedJson = objectMapper.writeValueAsBytes(root);

Review comment:
       Modified test case to use explicit JSON strings.




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


Reply via email to