Repository: apache/flink
File: flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/nodes/exec/serde/RexNodeJsonSerdeTest.java (Java)

Code before:
    public static class SerializableAsyncScalarFunction extends AsyncScalarFunction {

        @SuppressWarnings("unused")
        public void eval(CompletableFuture<String> res, Integer i) {
            throw new UnsupportedOperationException();
        }
    }

    /** Serializable process table function. */
    public static class SerializableProcessTableFunction extends ProcessTableFunction<String> {

        @SuppressWarnings("unused")
        public void eval(Integer i) {
            throw new UnsupportedOperationException();
        }

        @Override
        public TypeInference getTypeInference(DataTypeFactory typeFactory) {
            return TypeInference.newBuilder()
                    .typedArguments(DataTypes.INT())
                    .outputTypeStrategy(TypeStrategies.explicit(DataTypes.STRING()))
                    .disableSystemArguments(true)
                    .build();
        }
    }

    /** Non-serializable function. */
    public static class NonSerializableScalarFunction extends ScalarFunction {
        @SuppressWarnings({"FieldCanBeLocal", "unused"})
        private final boolean flag;

        public NonSerializableScalarFunction(boolean flag) {
            this.flag = flag;
        }

        @SuppressWarnings("unused")
        public String eval(Integer i) {
            throw new UnsupportedOperationException();
        }
    }

    /** Non-serializable function definition. */
    public static class NonSerializableFunctionDefinition implements FunctionDefinition {

        @Override
        public FunctionKind getKind() {
            return FunctionKind.SCALAR;
        }

        @Override
        public TypeInference getTypeInference(DataTypeFactory typeFactory) {

Review comment (suggestion):
The code seems good. I am curious about the name of this class. It is possible to have a non serializable PTF?  If not, I suggest naming this something like `MyProcessTableFunction` to prevent confusion. If we can reasonably have a  non serializable PTF, we should have a test for this.

Code after:

    /** Serializable function for modification. */
    public static class OtherSerializableScalarFunction extends ScalarFunction {

        @SuppressWarnings("unused")
        public String eval(Integer i) {
            throw new UnsupportedOperationException();
        }

        @Override
        public boolean equals(Object obj) {
            return obj instanceof OtherSerializableScalarFunction;
        }
    }

    /** Serializable async function. */
    public static class SerializableAsyncScalarFunction extends AsyncScalarFunction {

        @SuppressWarnings("unused")
        public void eval(CompletableFuture<String> res, Integer i) {
            throw new UnsupportedOperationException();
        }
    }

    /** Serializable process table function. */
    public static class SerializableProcessTableFunction extends ProcessTableFunction<String> {

        @SuppressWarnings("unused")
        public void eval(Integer i) {
            throw new UnsupportedOperationException();
        }

        @Override
        public TypeInference getTypeInference(DataTypeFactory typeFactory) {
            return TypeInference.newBuilder()
                    .typedArguments(DataTypes.INT())
                    .outputTypeStrategy(TypeStrategies.explicit(DataTypes.STRING()))
                    .disableSystemArguments(true)
                    .build();
        }
    }

    /** Non-serializable function. */
    public static class NonSerializableScalarFunction extends ScalarFunction {
        @SuppressWarnings({"FieldCanBeLocal", "unused"})
        private final boolean flag;

        public NonSerializableScalarFunction(boolean flag) {
            this.flag = flag;
        }