MapReduce中重写WritableComparator的compare不生效的原因
最近在学习MapReduce时,找了一些小案例练习,案例中需要map输出和分组时都实现自定义比较规则,于是继承了WritableComparator类,并重写了compare方法,但发现自定义的比较规则始终没有生效,最终发现是重写的方法错了。
注意WritableComparator有多种compare方法,如下:
@Override
public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
try
原创
2020-10-16 13:29:33 ·
903 阅读 ·
0 评论