Hive Functions

    For detailed information, please refer to HiveModule.

    Java

    Scala

    1. val name = "myhive"
    2. val version = "2.3.4"

    YAML

    1. - name: core
    2. type: core
    3. - 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:

    1. hive> show functions;
    2. OK
    3. ......
    4. mygenericudf
    5. myudtf

    Then, users can use them in SQL as: