@SuppressWarnings("unchecked")
    private UDFType deserializeUDF() {
        return (UDFType)
                deserializeObjectFromKryo(udfSerializedBytes, (Class<Serializable>) getUDFClass());
    }
@SuppressWarnings("unchecked")
    @Test
    public void testDeserializeUDF() throws Exception {
        // test deserialize udf
        GenericUDFMacro udfMacro = new GenericUDFMacro();
        HiveFunctionWrapper<GenericUDFMacro> functionWrapper =
                new HiveFunctionWrapper<>(GenericUDFMacro.class, udfMacro);
        GenericUDFMacro deserializeUdfMacro = functionWrapper.createFunction();
        assertThat(deserializeUdfMacro.getClass().getName())
                .isEqualTo(GenericUDFMacro.class.getName());

        // test deserialize udf loaded by user code class loader instead of current thread class
        // loader
        ClassLoader userClassLoader =
                FlinkUserCodeClassLoaders.create(
                        new URL[] {udfJar.toURI().toURL()},
                        getClass().getClassLoader(),
                        new Configuration());
        Class<ScalarFunction> udfClass =
                (Class<ScalarFunction>) userClassLoader.loadClass(udfClassName);
        ScalarFunction udf = udfClass.newInstance();
        HiveFunctionWrapper<ScalarFunction> functionWrapper1 =
                new HiveFunctionWrapper<>(udfClass, udf);
        ScalarFunction deserializedUdf = functionWrapper1.createFunction();
        assertThat(deserializedUdf.getClass().getName()).isEqualTo(udfClassName);
    }