Hive自定义函数

    1. UDF

    实现步骤
    ·定义一个类
    ·继承一个UDF类
    ·约定俗成 重写evaluate方法
    ·在方法中写实现代码
    ·打包项目
    ·上传到hdfs中
    ·hive添加jar包并创建临时函数
    ·使用函数测试

    1. UDAF

    实现方法
    ·定义一个类继承UDAF类
    ·定义一个内部静态类,实现UDAFEvaluator接口
    ·实现init,iterate,terminatePartial,merge,terminate5个方法
    ·打包项目
    ·上传到hdfs中
    ·hive添加jar包并创建临时函数
    ·使用函数测试

    1. UDTF

    实现方法
    ·定义一个类继承GenericUDTF方法
    ·重写initialize, process, close三个方法
    ·打包项目
    ·上传到hdfs中
    ·hive添加jar包并创建临时函数
    ·使用函数测试

    Hive参数

    1. hive参数列表

    ·了解即可

    1. hive参数使用

    四种方法
    ·通过配置文件
    ·通过进入hive -cli是指定参数
    ·进入hive后使用set设置session级的参数
    ·通过shell脚本调用hive -e做参数和脚本执行