Copilot commented on code in PR #51619: URL: https://github.com/apache/doris/pull/51619#discussion_r2139448761
########## fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java: ########## @@ -2338,6 +2347,44 @@ public static FunctionCallExpr createMergeAggCall( return result; } + public static class FunctionCallExprSerializer + implements JsonSerializer<FunctionCallExpr>, JsonDeserializer<FunctionCallExpr> { + @Override + public JsonElement serialize(FunctionCallExpr value, java.lang.reflect.Type reflectType, + JsonSerializationContext context) { + JsonObject jsonObject = new JsonObject(); + jsonObject.add("clazz", context.serialize(value.getClass().getSimpleName())); + jsonObject.add("iafc", context.serialize(value.isAnalyticFnCall)); + jsonObject.add("itfc", context.serialize(value.isTableFnCall)); Review Comment: The serializer writes a "clazz" field using `getSimpleName()`, but the deserializer never reads this property. Either remove this redundant field or update `deserialize()` to validate or use it, ensuring symmetry between serialization and deserialization. ```suggestion jsonObject.add("iafc", context.serialize(value.isAnalyticFnCall)); jsonObject.add("itfc", context.serialize(value.isTableFnCall)); jsonObject.add("itfc", context.serialize(value.isTableFnCall)); ``` ########## fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java: ########## @@ -2338,6 +2347,44 @@ public static FunctionCallExpr createMergeAggCall( return result; } + public static class FunctionCallExprSerializer + implements JsonSerializer<FunctionCallExpr>, JsonDeserializer<FunctionCallExpr> { + @Override + public JsonElement serialize(FunctionCallExpr value, java.lang.reflect.Type reflectType, + JsonSerializationContext context) { + JsonObject jsonObject = new JsonObject(); + jsonObject.add("clazz", context.serialize(value.getClass().getSimpleName())); + jsonObject.add("iafc", context.serialize(value.isAnalyticFnCall)); + jsonObject.add("itfc", context.serialize(value.isTableFnCall)); + jsonObject.add("fnn", context.serialize(value.fnName)); + jsonObject.add("fnp", context.serialize(value.fnParams)); + return jsonObject; + } + + @Override + public FunctionCallExpr deserialize(JsonElement json, java.lang.reflect.Type typeOfT, + JsonDeserializationContext context) throws JsonParseException { + JsonObject jsonObject = json.getAsJsonObject(); + FunctionName fnName = context.deserialize(jsonObject.get("fnn"), FunctionName.class); + FunctionParams fnParams = context.deserialize(jsonObject.get("fnp"), FunctionParams.class); + boolean isAnalyticFnCall = jsonObject.get("iafc").getAsBoolean(); + boolean isTableFnCall = jsonObject.get("itfc").getAsBoolean(); + FunctionCallExpr expr = new FunctionCallExpr(fnName, fnParams); + expr.setIsAnalyticFnCall(isAnalyticFnCall); + expr.setTableFnCall(isTableFnCall); Review Comment: After deserializing `FunctionCallExpr`, `gsonPostProcess()` is not invoked, so children from `fnParams.exprs()` won't be populated. Call `expr.gsonPostProcess()` before returning to ensure the post-processing logic runs. ```suggestion expr.setTableFnCall(isTableFnCall); expr.gsonPostProcess(); // Ensure post-processing logic runs ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org