wuchong commented on code in PR #23012:
URL: https://github.com/apache/flink/pull/23012#discussion_r1267600427


##########
flink-formats/flink-json/src/test/java/org/apache/flink/formats/json/JsonParserRowDataDeSerSchemaTest.java:
##########
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.formats.json;
+
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.formats.common.TimestampFormat;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonProcessingException;
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode;
+
+import org.junit.jupiter.api.Test;
+
+import static 
org.apache.flink.connector.testutils.formats.SchemaTestUtils.open;
+import static org.apache.flink.table.api.DataTypes.FIELD;
+import static org.apache.flink.table.api.DataTypes.INT;
+import static org.apache.flink.table.api.DataTypes.ROW;
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Tests for {@link JsonRowDataDeserializationSchema} and {@link 
JsonRowDataSerializationSchema}.

Review Comment:
   nit: `JsonRowDataDeserializationSchema` -> 
`JsonParserRowDataDeserializationSchema`?



##########
flink-formats/flink-json/src/test/java/org/apache/flink/formats/json/JsonRowDataSerDeSchemaTest.java:
##########
@@ -86,8 +89,9 @@ class JsonRowDataSerDeSchemaTest {
 
     private static final ObjectMapper OBJECT_MAPPER = 
JacksonMapperFactory.createObjectMapper();
 
-    @Test
-    void testSerDe() throws Exception {
+    @ParameterizedTest(name = "Is JsonParser: {0}")

Review Comment:
   Why not use a class-level Parameterized test? You can take 
`RowLevelDeleteTest` as an example. 



##########
flink-formats/flink-json/src/test/java/org/apache/flink/formats/json/JsonRowDataSerDeSchemaTest.java:
##########
@@ -267,8 +267,84 @@ void testSlowDeserialization() throws Exception {
         assertThat(actual).isEqualTo(expected);
     }
 
+    /**
+     * Tests parsing partial fields in actual json data, sometimes we can skip 
some complex field
+     * parsing, e.g., field with Row/Array type.
+     */
     @Test
-    void testSerDeMultiRows() throws Exception {
+    public void testParsePartialJson() throws Exception {

Review Comment:
   Can we move this test to `JsonParserRowDataDeSerSchemaTest`?



##########
flink-formats/flink-json/src/test/java/org/apache/flink/formats/json/JsonRowDataSerDeSchemaTest.java:
##########
@@ -724,7 +786,7 @@ private void testParseErrors(TestSpec spec) {
                     TestSpec.json("{\"id\":\"abc\"}")
                             .rowType(ROW(FIELD("id", INT())))
                             .expectErrorMessage("Failed to deserialize JSON 
'{\"id\":\"abc\"}'."),
-                    TestSpec.json("{\"id\":112.013}")
+                    TestSpec.json("{\"id\":112}")

Review Comment:
   Will it fail? 



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to