try { int tsz1 = readSize(bb1); int tsz2 = readSize(bb2); if (tsz1 > tsz2) return 1; result = compareBinInterSedesDatum(bb1, bb2, mAsc); if (result == 0) result = compareBinInterSedesDatum(bb1, bb2, mSecondaryAsc); } else { result = compareBinInterSedesDatum(bb1, bb2, EMPTY_ASC); t2.readFields(new DataInputStream(new ByteArrayInputStream(bb2.array(), s2, bb2.limit()))); result = compare(t1, t2);
case BinInterSedes.NULL: { type1 = DataType.NULL; type2 = getGeneralizedDataType(dt2); if (asc != null) // we are scanning the top-level Tuple (original call) mHasNullField = true; case BinInterSedes.BOOLEAN_FALSE: { type1 = DataType.BOOLEAN; type2 = getGeneralizedDataType(dt2); if (type1 == type2) { type2 = getGeneralizedDataType(dt2); if (type1 == type2) { byte bv1 = bb1.get(); case BinInterSedes.INTEGER: { type1 = DataType.INTEGER; type2 = getGeneralizedDataType(dt2); if (type1 == type2) { int iv1 = readInt(bb1, dt1); int iv2 = readInt(bb2, dt2); rc = (iv1 < iv2 ? -1 : (iv1 == iv2 ? 0 : 1)); case BinInterSedes.LONG: { type1 = DataType.LONG; type2 = getGeneralizedDataType(dt2); if (type1 == type2) { long lv1 = readLong(bb1, dt1); long lv2 = readLong(bb2, dt2);
/** * Compare two BinSedesTuples as raw bytes. We assume the Tuples are NOT PigNullableWritable, so client classes * need to deal with Null and Index. */ @Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int rc = 0; ByteBuffer bb1 = ByteBuffer.wrap(b1, s1, l1); ByteBuffer bb2 = ByteBuffer.wrap(b2, s2, l2); try { rc = compareBinSedesTuple(bb1, bb2); } catch (IOException ioe) { mLog.error("I/O error during tuple comparison: " + ioe.getMessage()); throw new RuntimeException(ioe.getMessage(), ioe); } return rc; }
} else { rc = mWrappedComp.compare(b1, s1 + 1, l1 - 2, b2, s2 + 1, l2 - 2); if (rc == 0 && mWrappedComp.hasComparedTupleNull()) { rc = b1[s1 + 1] - b2[s2 + 1];
case BinInterSedes.TINYBAG: case BinInterSedes.TINYMAP: return getUnsignedByte(bb); case BinInterSedes.SMALLBYTEARRAY: case BinInterSedes.SMALLCHARARRAY: case BinInterSedes.SMALLBAG: case BinInterSedes.SMALLMAP: return getUnsignedShort(bb); case BinInterSedes.BYTEARRAY: case BinInterSedes.CHARARRAY:
result = compareDatum(t1.get(0), t2.get(0), mAsc); if (result == 0) result = compareDatum(t1.get(1), t2.get(1), mSecondaryAsc); } else { result = compareDatum(t1, t2, mAsc);
public PigBytesRawComparator() { super(NullableBytesWritable.class); mWrappedComp = new BinInterSedes.BinInterSedesTupleRawComparator(); }