@Override public int compare(Object o1, Object o2) { return ObjectInspectorUtils.compare(o1, oi, o2, oi); } }
public static int compare(Object[] o1, ObjectInspector[] oi1, Object[] o2, ObjectInspector[] oi2) { int c = 0; for (int i = 0; i < oi1.length; i++) { c = ObjectInspectorUtils.compare(o1[i], oi1[i], o2[i], oi2[i]); if (c != 0) { return c; } } return c; }
/** * Compare two objects with their respective ObjectInspectors. * Treat null as minimum value. */ public static int compare(Object o1, ObjectInspector oi1, Object o2, ObjectInspector oi2, MapEqualComparer mapEqualComparer) { return compare(o1, oi1, o2, oi2, mapEqualComparer, NullValueOption.MINVALUE); }
@Override public int compare(Object o1, Object o2) { return ObjectInspectorUtils.compare(o1, valInspector, o2, valInspector); } });
public static int compare(Object[] o1, ObjectInspector[] oi1, Object[] o2, ObjectInspector[] oi2) { int c = 0; for (int i = 0; i < oi1.length; i++) { c = ObjectInspectorUtils.compare(o1[i], oi1[i], o2[i], oi2[i]); if (c != 0) { return c; } } return c; }
@Override public int compare(Object o1, Object o2) { return ObjectInspectorUtils.compare(o1, valInspector, o2, valInspector); } });
public static int compare(Object[] o1, ObjectInspector[] oi1, Object[] o2, ObjectInspector[] oi2, boolean[] columnSortOrderIsDesc) { assert (o1.length == oi1.length); assert (o2.length == oi2.length); assert (o1.length == o2.length); for (int i = 0; i < o1.length; i++) { int r = compare(o1[i], oi1[i], o2[i], oi2[i]); if (r != 0) { if (columnSortOrderIsDesc[i]) { return r; } else { return -r; } } } return 0; }
/** * Compare two arrays of objects with their respective arrays of * ObjectInspectors. */ public static int compare(Object[] o1, ObjectInspector[] oi1, Object[] o2, ObjectInspector[] oi2) { assert (o1.length == oi1.length); assert (o2.length == oi2.length); assert (o1.length == o2.length); for (int i = 0; i < o1.length; i++) { int r = compare(o1[i], oi1[i], o2[i], oi2[i]); if (r != 0) { return r; } } return 0; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || obj.getClass() != this.getClass()) { return false; } ObjectInspectorObject comparedObject = (ObjectInspectorObject)obj; return ObjectInspectorUtils.compare(objects, oi, comparedObject.objects, comparedObject.oi) == 0; }
@Override public void merge(AggregationBuffer agg, Object partial) throws HiveException { if (partial != null) { MaxAgg myagg = (MaxAgg) agg; int r = ObjectInspectorUtils.compare(myagg.o, outputOI, partial, inputOI); if (myagg.o == null || r < 0) { myagg.o = ObjectInspectorUtils.copyToStandardObject(partial, inputOI, ObjectInspectorCopyOption.JAVA); } } }
public static void sort(Object[][] rows, ObjectInspector oi) { for (int i = 0; i < rows.length; i++) { for (int j = i + 1; j < rows.length; j++) { if (ObjectInspectorUtils.compare(rows[i], oi, rows[j], oi) > 0) { Object[] t = rows[i]; rows[i] = rows[j]; rows[j] = t; } } } }
/** * Compare two objects with their respective ObjectInspectors. */ public static int compare(Object o1, ObjectInspector oi1, Object o2, ObjectInspector oi2) { return compare(o1, oi1, o2, oi2, new FullMapEqualComparer()); }
@Override public void merge(AggregationBuffer agg, Object partial) throws HiveException { if (partial != null) { MaxAgg myagg = (MaxAgg) agg; int r = ObjectInspectorUtils.compare(myagg.o, outputOI, partial, inputOI); if (myagg.o == null || r < 0) { myagg.o = ObjectInspectorUtils.copyToStandardObject(partial, inputOI, ObjectInspectorCopyOption.JAVA); } } }
private boolean isGreater(Object in, Object last) { if (in == null) { return false; } if (last == null) { return true; } return ObjectInspectorUtils.compare(in, inputOI(), last, outputOI()) > 0; }
@Override public void merge(AggregationBuffer agg, Object partial) throws HiveException { if (partial != null) { MinAgg myagg = (MinAgg) agg; int r = ObjectInspectorUtils.compare(myagg.o, outputOI, partial, inputOI, new FullMapEqualComparer(), NullValueOption.MAXVALUE); if (myagg.o == null || r > 0) { myagg.o = ObjectInspectorUtils.copyToStandardObject(partial, inputOI, ObjectInspectorCopyOption.JAVA); } } }
private boolean isLess(Object in, Object last) { if (in == null) { return false; } if (last == null) { return true; } return ObjectInspectorUtils.compare(in, inputOI(), last, outputOI()) < 0; }
@Override public int compare(KeyWrapper key1, KeyWrapper key2) { return ObjectInspectorUtils.compare(key1.getKeyArray(), objectInspectors1, key2.getKeyArray(), objectInspectors2, columnSortOrderIsDesc); } }
@Override public void merge(AggregationBuffer agg, Object partial) throws HiveException { if (partial != null) { MinAgg myagg = (MinAgg) agg; int r = ObjectInspectorUtils.compare(myagg.o, outputOI, partial, inputOI, new FullMapEqualComparer(), NullValueOption.MAXVALUE); if (myagg.o == null || r > 0) { myagg.o = ObjectInspectorUtils.copyToStandardObject(partial, inputOI, ObjectInspectorCopyOption.JAVA); } } }
private boolean isGreater(Object in, Object last) { if (in == null) { return false; } if (last == null) { return true; } return ObjectInspectorUtils.compare(in, inputOI(), last, outputOI()) > 0; }
private boolean isLess(Object in, Object last) { if (in == null) { return false; } if (last == null) { return true; } return ObjectInspectorUtils.compare(in, inputOI(), last, outputOI()) < 0; }