Example usage for org.apache.hadoop.mapred.lib KeyFieldBasedComparator compare

List of usage examples for org.apache.hadoop.mapred.lib KeyFieldBasedComparator compare

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred.lib KeyFieldBasedComparator compare.

Prototype

public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) 

Source Link

Usage

From source file:crunch.MaxTemperature.java

License:Apache License

private void check(String options, Text l1, Text l2, int c) throws IOException {
        JobConf conf = new JobConf();
        conf.setKeyFieldComparatorOptions(options);
        KeyFieldBasedComparator comp = new KeyFieldBasedComparator();
        comp.configure(conf);/*  w  ww  .jav  a 2s  .co  m*/

        DataOutputBuffer out1 = serialize(l1);
        DataOutputBuffer out2 = serialize(l2);
        assertThat(options, comp.compare(out1.getData(), 0, out1.getLength(), out2.getData(), 0, out2.getLength()),
                is(c));
    }