chaokunyang commented on code in PR #2338:
URL: https://github.com/apache/fory/pull/2338#discussion_r2153786941
##########
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:
Introduce a local variable made teh code bloat a little, so if this variable
is used only once, fory just use `ExpressionUtils.eqNull` directly
--
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]