Call the UDF in a query
After registration of a UDF, you do not need to restart Hive before using the UDF in a query. In this example, you call the UDF you created in a SELECT statement, and Hive returns the data type of a column you specify.
- For the example query in this task, you need to create a table in Hive and insert some data.
- As a user, you need to have permission to call a UDF, which a Ranger policy can provide.
+------------------+---------------+---------------+
| students.name | students.age | students.gpa |
+------------------+---------------+---------------+
| fred flintstone | 35 | 1.28 |
| barney rubble | 32 | 2.32 |
+------------------+---------------+---------------+
You can use the UDF you created in previous tasks in a query to get the data type of the name column in the students table.