stevenschlansker commented on code in PR #2338:
URL: https://github.com/apache/fory/pull/2338#discussion_r2155603459


##########
java/fory-format/src/main/java/org/apache/fory/format/encoder/BaseBinaryEncoderBuilder.java:
##########
@@ -164,15 +167,21 @@ protected Expression serializeFor(
           serializeFor(
               ordinal, newInputObject, writer, rewrittenType, arrowField, 
visitedCustomTypes);
       return new If(
-          ExpressionUtils.eqNull(inputObject),
+          new Expression.IsNull(inputObject),
           new Invoke(writer, "setNullAt", ordinal),
           doSerialize);
     } else if (rawType == Optional.class) {
       TypeRef<?> elemType = TypeUtils.getTypeArguments(typeRef).get(0);
       Invoke orNull =
-          new Invoke(inputObject, "orElse", TypeUtils.OBJECT_TYPE, new 
Expression.Null(elemType));
+          new Invoke(
+              inputObject,
+              "orElse",
+              "",
+              TypeUtils.OBJECT_TYPE,
+              true,
+              new Expression.Null(elemType));
       Expression unwrapped =
-          new If(ExpressionUtils.eqNull(inputObject), new 
Expression.Null(elemType), orNull);

Review Comment:
   At least in these cases, the isNull variable is computed either way 
(although maybe later removed as dead code by jit) so might as well use it 
since we spend the method space anyway



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

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to