Hive Functions
For detailed information, please refer to HiveModule.
Java
Scala
val name = "myhive"
val version = "2.3.4"
YAML
- name: core
type: core
- name: myhive
Users can use their existing Hive User Defined Functions in Flink.
- UDF
- GenericUDF
- GenericUDTF
- UDAF
Upon query planning and execution, Hive’s UDF and GenericUDF are automatically translated into Flink’s ScalarFunction, Hive’s GenericUDTF is automatically translated into Flink’s TableFunction, and Hive’s UDAF and GenericUDAFResolver2 are translated into Flink’s AggregateFunction.
To use a Hive User Defined Function, user have to
- set a HiveCatalog backed by Hive Metastore that contains that function as current catalog of the session
- include a jar that contains that function in Flink’s classpath
Assuming we have the following Hive functions registered in Hive Metastore:
hive> show functions;
OK
......
mygenericudf
myudtf
Then, users can use them in SQL as: