血缘分析
1. LineageLogger
首先需要对 org.apache.hadoop.hive.ql.hooks.LineageLogger 这个类进行改写,原类会把 lineage 字段依赖信息打印到日志里去,但是现在我们需要把 lineage 信息直接 return 回来。
1 | String lineage = out.toString(); |
2. 添加 hook
Hive 提供了多个 hook 给开发者调用,对于字段分析来说,需要在 conf 里添加 hConf.set("hive.exec.post.hooks", "org.apache.hadoop.hive.ql.hooks.LineageLogger")
3. LineageInfo
1 | package cn.edata.StageTest; |
4. TableDependency
除了字段的血缘分析,还可以进一步去获取表之间的依赖关系
1 | package cn.edata.StageTest; |
5. pom.xml
1 | <properties> |