This documentation is for an out-of-date version of Apache Flink. We recommend you use the latest stable version.
Use Hive Built-in Functions via HiveModule
The HiveModule provides Hive built-in functions as Flink system (built-in) functions to Flink SQL and Table API users.
For detailed information, please refer to HiveModule.
NOTE that some Hive built-in functions in older versions have thread safety issues.
We recommend users patch their own Hive to fix them.
Hive User Defined Functions
Users can use their existing Hive User Defined Functions in Flink.
Supported UDF types include:
UDF
GenericUDF
GenericUDTF
UDAF
GenericUDAFResolver2
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
use Blink planner.
Using Hive User Defined Functions
Assuming we have the following Hive functions registered in Hive Metastore: