Creating and running Temporary functions are discouraged while running a query on LLAP because of security reason since many users are sharing same instances of LLAP, it can create a conflict but still, you can create temp functions using add jar and hive.llap.execution.mode=auto.
with exclusive llap execution mode(hive.llap.execution.mode=only) you will run into the ClassNotFoundException, hive.llap.execution.mode=auto will allow some part of query(map tasks) to run in the tez container.
Here are steps to create a custom permanent function in LLAP(steps are tested on HDP-260)
1. create a jar for UDF function (in this case I am using simple udf):
4. add the jar to Auxillary JAR list (goto Ambari--> hive --> config --> Auxillary JAR list)
Auxillary JAR list=/tmp/SampleCode.jar
5. restart LLAP
6. create Permanent Custom function
connect to HSI using beeline
create FUNCTION CustomLength as 'com.rajkrrsingh.hiveudf.CustomLength';
describe function CustomLength;
select CustomLength(description) from sample_07 limit 1;