Tabnine Logo
IntWritable.compareTo
Code IndexAdd Tabnine to your IDE (free)

How to use
compareTo
method
in
org.apache.hadoop.io.IntWritable

Best Java code snippets using org.apache.hadoop.io.IntWritable.compareTo (Showing top 14 results out of 315)

origin: mahmoudparsian/data-algorithms-book

@Override
public int compareTo(DateTemperaturePair pair) {
  int compareValue = this.yearMonth.compareTo(pair.getYearMonth());
  if (compareValue == 0) {
    compareValue = temperature.compareTo(pair.getTemperature());
  }
  //return compareValue; 		// to sort ascending 
  return -1*compareValue;     // to sort descending 
}
origin: apache/asterixdb

@Override
public int compare(String s1, String s2) {
  return locationToNumSplits.get(s1).compareTo(locationToNumSplits.get(s2));
}
origin: pranab/chombo

@Override
public int compareTo(IntPair tiPair) {
  int cmp = first.compareTo(tiPair.getFirst());
  if (0 == cmp) {
    cmp = second.compareTo(tiPair.getSecond());
  }
  return cmp;
}

origin: org.apache.hadoop/hadoop-mapred-test

public void reduce(IntWritable key,
          Iterator<IntWritable> values,
          OutputCollector<IntWritable, Text> out,
          Reporter reporter) throws IOException {
 // check key order
 int currentKey = key.get();
 if (currentKey < lastKey) {
  fail("Keys not in sorted ascending order");
 }
 lastKey = currentKey;
 // check order of values
 IntWritable previous = new IntWritable(Integer.MIN_VALUE);
 int valueCount = 0;
 while (values.hasNext()) {
  IntWritable current = values.next();
  
  // Check that the values are sorted
  if (current.compareTo(previous) < 0)
   fail("Values generated by Mapper not in order");
  previous = current;
  ++valueCount;
 }
 if (valueCount != 5) {
  fail("Values not grouped by primary key");
 }
 out.collect(key, new Text("success"));
}
origin: org.apache.hadoop/hadoop-mapred-test

public void reduce(IntWritable key,
          Iterator<IntWritable> values,
          OutputCollector<IntWritable, Text> out,
          Reporter reporter) throws IOException {
 // check key order
 int currentKey = key.get();
 if (currentKey > lastKey) {
  fail("Keys not in sorted descending order");
 }
 lastKey = currentKey;
 // check order of values
 IntWritable previous = new IntWritable(Integer.MAX_VALUE);
 int valueCount = 0;
 while (values.hasNext()) {
  IntWritable current = values.next();
  
  // Check that the values are sorted
  if (current.compareTo(previous) > 0)
   fail("Values generated by Mapper not in order");
  previous = current;
  ++valueCount;
 }
 if (valueCount != 5) {
  fail("Values not grouped by primary key");
 }
 out.collect(key, new Text("success"));
}
origin: MrChrisJohnson/CollabStream

public int compareTo(IntMatrixItemPair o) {
  int cmp = reducerNum.compareTo(o.reducerNum);
  if (cmp != 0) {
    return cmp;
  }
  return matItem.compareTo(o.getMatItem());
}
origin: mayconbordin/storm-applications

@Override
public int compareTo(TextInt other) {
  int cmp = first.compareTo(other.getFirst());
  if (0 == cmp) {
    cmp = second.compareTo(other.getSecond());
  }
  return cmp;
}

origin: apache/asterixdb

    return assignmentDifference;
  return locationToNumSplits.get(s1).compareTo(locationToNumSplits.get(s2));
});
origin: pranab/chombo

@Override
public int compareTo(TextInt other) {
  int cmp = first.compareTo(other.getFirst());
  if (0 == cmp) {
    cmp = second.compareTo(other.getSecond());
  }
  return cmp;
}

origin: edu.umd/cloud9

 public int compare(PairOfWritables<Text, IntWritable> e1,
   PairOfWritables<Text, IntWritable> e2) {
  if (e2.getRightElement().compareTo(e1.getRightElement()) == 0) {
   return e1.getLeftElement().compareTo(e2.getLeftElement());
  }
  return e2.getRightElement().compareTo(e1.getRightElement());
 }
});
origin: apache/incubator-rya

@Override
public int compareTo(CompositeType o) {
 int compare = getOldKey().compareTo(o.getOldKey());
 if (compare != 0) {
  return compare;
 }
 return getPriority().compareTo(o.getPriority());
}
origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient

public void reduce(IntWritable key,
          Iterator<IntWritable> values,
          OutputCollector<IntWritable, Text> out,
          Reporter reporter) throws IOException {
 // check key order
 int currentKey = key.get();
 if (currentKey < lastKey) {
  fail("Keys not in sorted ascending order");
 }
 lastKey = currentKey;
 // check order of values
 IntWritable previous = new IntWritable(Integer.MIN_VALUE);
 int valueCount = 0;
 while (values.hasNext()) {
  IntWritable current = values.next();
  
  // Check that the values are sorted
  if (current.compareTo(previous) < 0)
   fail("Values generated by Mapper not in order");
  previous = current;
  ++valueCount;
 }
 if (valueCount != 5) {
  fail("Values not grouped by primary key");
 }
 out.collect(key, new Text("success"));
}
origin: stackoverflow.com

 public class MyDataType implements WritableComparable<MyDataType> {
  private Text name;
  private IntWritable age;

  @Override
  public void readFields(DataInput in) throws IOException {
    name.readFields(in);
    age.readFields(in);
  }

  @Override
  public void write(DataOutput out) throws IOException {
    name.write(out);
    age.write(out);
  }

  @Override
  public int compareTo(MyDataType o) {
    int nameCompare = name.compareTo(o.name);
    if(nameCompare != 0) {
      return nameCompare;
    } else {
      return age.compareTo(o.age);
    }
  }
}
origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient

public void reduce(IntWritable key,
          Iterator<IntWritable> values,
          OutputCollector<IntWritable, Text> out,
          Reporter reporter) throws IOException {
 // check key order
 int currentKey = key.get();
 if (currentKey > lastKey) {
  fail("Keys not in sorted descending order");
 }
 lastKey = currentKey;
 // check order of values
 IntWritable previous = new IntWritable(Integer.MAX_VALUE);
 int valueCount = 0;
 while (values.hasNext()) {
  IntWritable current = values.next();
  
  // Check that the values are sorted
  if (current.compareTo(previous) > 0)
   fail("Values generated by Mapper not in order");
  previous = current;
  ++valueCount;
 }
 if (valueCount != 5) {
  fail("Values not grouped by primary key");
 }
 out.collect(key, new Text("success"));
}
org.apache.hadoop.ioIntWritablecompareTo

Javadoc

Compares two IntWritables.

Popular methods of IntWritable

  • get
    Return the value of this IntWritable.
  • <init>
  • set
    Set the value of this IntWritable.
  • toString
  • write
  • readFields
  • equals
    Returns true iff o is a IntWritable with the same value.
  • hashCode
  • getClass

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • setContentView (Activity)
  • setScale (BigDecimal)
  • Menu (java.awt)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Notification (javax.management)
  • JFileChooser (javax.swing)
  • JTextField (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now