1. 创建项目new project
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  2. 选择MaxCompute Studio工程
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  3. 写入项目名
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  4. 新建模块new Model
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  5. 选择"MaxCompute Java"类型模块,右侧我什么都没选哦~
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  6. 写入模块名
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  7. 点击"Finish"自动生成pom文件
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  8. 右键模块下的"java"文件夹,new一个"MaxCompute java"
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  9. 创建java文件
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  10. 编写UDF逻辑代码。这里通过传入日期参数,返回一年中的第几周。类似MaxCompute中的weekofyear()函数, weekofyear()是从周一开始算一周的第一天;本次UDF是从周日凌晨开始算一周的第一天。
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  11. local模式测试不好使,用测试类来测试~
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  12. 加载已存在的MaxCompute项目
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  13. 右键编写好的UDF类,点击"Deploy to server"。
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  14. 发布成功,可在"Project Explorer" 对应项目中的 Functions - UserDefined目录下找到
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  15. 创建一个SQL脚本
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  16. 选择对应的MaxCompute项目
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数
  17. 编写SQL,测试发布的UDF,可见返回结果。
    Intellij IDEA实现Maxcompute UDF自定义函数以周日为一周第一天的周数

相关文章:

  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2021-10-10
  • 2021-07-25
  • 2021-06-07
  • 2021-09-07
  • 2021-08-13
  • 2021-11-09
  • 2021-09-03
相关资源
相似解决方案