xintongsong commented on code in PR #23: URL: https://github.com/apache/flink-agents/pull/23#discussion_r2160201661
########## plan/src/main/java/org/apache/flink/agents/plan/JavaFunction.java: ########## @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.flink.agents.plan; + +import java.lang.reflect.Method; +import java.util.Arrays; + +/** Represent a Java function. */ +public class JavaFunction implements Function { + private final String qualName; + private final String methodName; + private final Class<?>[] parameterTypes; + private final Class<?> clazz; Review Comment: Seems we don't need the `clazz` as a field of the class. ########## plan/src/main/java/org/apache/flink/agents/plan/JavaFunction.java: ########## @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.flink.agents.plan; + +import java.lang.reflect.Method; +import java.util.Arrays; + +/** Represent a Java function. */ +public class JavaFunction implements Function { + private final String qualName; + private final String methodName; + private final Class<?>[] parameterTypes; + private final Class<?> clazz; + private final Method method; Review Comment: `Method` is non serializable. And we need the Function to be serializable in order to deploy the workflow plan across distributed TMs. This is why the Function only contains qualName, methodName and parameterTypes in the first place. I'm fine with checking the existence of method early in the constructor. But I think we need a way to tell the serializer that `method` should not be serialized. E.g., in Java Serialization we use the keyword `transient`. Not sure how it's done in Jackson. -- 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]
