godfreyhe commented on a change in pull request #14878:
URL: https://github.com/apache/flink/pull/14878#discussion_r584538940



##########
File path: 
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/JsonSerdeUtil.java
##########
@@ -44,15 +44,17 @@ public static boolean hasJsonCreatorAnnotation(Class<?> 
clazz) {
 
     /** Create an {@link ObjectMapper} which DeserializationContext wraps a 
{@link SerdeContext}. */
     public static ObjectMapper createObjectMapper(SerdeContext serdeCtx) {
+        FlinkDeserializationContext ctx =
+                new FlinkDeserializationContext(
+                        new 
DefaultDeserializationContext.Impl(BeanDeserializerFactory.instance),
+                        serdeCtx);
         ObjectMapper mapper =
                 new ObjectMapper(
                         null, // JsonFactory
                         null, // DefaultSerializerProvider
-                        new FlinkDeserializationContext(
-                                new DefaultDeserializationContext.Impl(
-                                        BeanDeserializerFactory.instance),
-                                serdeCtx));
+                        ctx);
         mapper.configure(MapperFeature.USE_GETTERS_AS_SETTERS, false);
+        ctx.setObjectMapper(mapper);

Review comment:
       Because we use the mapper to deserialize the `RelDataType`. There are 
two approach to avoid the cyclic dependency:
   1. we use `JsonParser` as streaming mode the deserialize the json. but it's 
very complex to support it, because the json structure is different for 
different RexNode.
   2. we create an ObjectMapper instance when it needed, and the corresponding 
serializers/deserializers are also needed to register, and it's a heavy 
operation to create an ObjectMapper instance.  




----------------------------------------------------------------
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:
[email protected]


Reply via email to