0
votes

I am trying to write a Hive UDF using Scala. This UDF should run a query on another hive table and return the obtained value

For eg. I have a master table in hive with columns emp_id,start_date,end_date,salary. I am trying to come up with a hive udf using scala to create a function(getSal) where I can pass id and some date and get the effective salary for that id in another hive query as select *, getSal(emp_id,passed_date) as salary from some table;

Can you tell me how to achieve this?

note - i can get the details by joining my table with master table and running between clause but would like to explore the UDF solution.

1
Hi @shah, the phantom is right this is not possible. UDF main purpose is to do calculations/processing to make your code maintainable and easier to read - abiratsis
A No is also an answer. - thebluephantom
Can you accept the answer please? That is the protocol here. - thebluephantom

1 Answers

0
votes

This is simply not possible, nor desirable when you think about it from a performance point of view. At least if I have understood your question, more so from the title.