Hive Udf Rank的示例分析
小编给大家分享一下Hive Udf Rank的示例分析,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
public final class Rank extends UDF { private int counter; private String last_dp_id; private String last_tid; //多参数 public int evaluate(String dp_id, String tid) { if (dp_id.equalsIgnoreCase(this.last_dp_id) && tid.equalsIgnoreCase(this.last_tid)) { this.counter++; }else{ this.counter = 0; this.last_dp_id = dp_id; this.last_tid = tid; } return this.counter; } //一个参数 public int evaluate(final String tid) { if (!tid.equals(this.last_tid)) { this.counter = 0; this.last_tid = tid; } return this.counter++; } }
看完了这篇文章,相信你对“Hive Udf Rank的示例分析”有了一定的了解,如果想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!