@Test public final void testCompare() { Schema schema = SchemaBuilder.builder() .add("col1", Type.INT4) .add("col2", Type.INT4) .add("col3", Type.INT4) .add("col4", Type.INT4) .add("col5", Type.TEXT) .build(); VTuple tuple1 = new VTuple( new Datum[] { DatumFactory.createInt4(9), DatumFactory.createInt4(3), DatumFactory.createInt4(33), DatumFactory.createInt4(4), DatumFactory.createText("abc")}); VTuple tuple2 = new VTuple( new Datum[] { DatumFactory.createInt4(1), DatumFactory.createInt4(25), DatumFactory.createInt4(109), DatumFactory.createInt4(4), DatumFactory.createText("abd")}); SortSpec sortKey1 = new SortSpec(schema.getColumn("col4"), true, false); SortSpec sortKey2 = new SortSpec(schema.getColumn("col5"), true, false); BaseTupleComparator tc = new BaseTupleComparator(schema, new SortSpec[] {sortKey1, sortKey2}); assertEquals(-1, tc.compare(tuple1, tuple2)); assertEquals(1, tc.compare(tuple2, tuple1)); }
public abstract int compare(Tuple o1, Tuple o2);
TupleComparator implements Comparator<Tuple>, ProtoObject<TupleComparatorProto> { public abstract int compare(Tuple o1, Tuple o2); }
TupleComparator implements Comparator<Tuple>, ProtoObject<TupleComparatorProto> { public abstract int compare(Tuple o1, Tuple o2);  }
TupleComparator implements Comparator<Tuple>, ProtoObject<TupleComparatorProto> { public abstract int compare(Tuple o1, Tuple o2);  abstract int compare(Tuple o1, Tuple o2); abstract boolean isAscendingFirstKey(); }
TupleComparator implements Comparator<Tuple>, ProtoObject<TupleComparatorProto> { public abstract int compare(Tuple o1, Tuple o2);  abstract int compare(Tuple o1, Tuple o2); abstract boolean isAscendingFirstKey();  }