Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to register Java method as UDF in spark(Java) ?

How to register Java method as UDF in spark(Java) ?

Explorer

I wanted to register a java function as udf in spark. I am using java to build the spark application.

Java class that contain function.

public class Decryption{       

public String decrypt(final String encryptedText){   

return new String(decryptedText);

}

}

Spark code
I am trying to do something like this

spark.udf().register("decrypt", decryption.decrypt(encryptedText))
Don't have an account?
Coming from Hortonworks? Activate your account here