libenchao commented on a change in pull request #11180: [FLINK-16220][json] Fix 
JsonRowSerializationSchema cast exception due…
URL: https://github.com/apache/flink/pull/11180#discussion_r393648591
 
 

 ##########
 File path: 
flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowSerializationSchema.java
 ##########
 @@ -360,7 +360,8 @@ private SerializationRuntimeConverter assembleRowConverter(
                return (mapper, reuse, object) -> {
                        ObjectNode node;
 
-                       if (reuse == null) {
+                       // reuse could be a NullNode if last record is null.
+                       if (!(reuse instanceof ObjectNode)) {
 
 Review comment:
   Yes, I write it like `if (reuse == null || !(reuse instanceof ObjectNode))` 
for the first version. But the IDE suggests to remove `reuse == null` because 
`instanceof` can cover that.
   However, your way seems more straight forward, and the IDE won't complain 
about it. I'll change it this way.

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


With regards,
Apache Git Services

Reply via email to