/** {@inheritDoc} */ @Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { return BinaryData.compare(b1, s1, b2, s2, mSchema); }
continue; int c = compare(d, field.schema()); if (c != 0) return (field.order() != Field.Order.DESCENDING) ? c : -c; long l = Math.min(l1, l2); while (i < l) { // compare to end of block int c = compare(d, schema.getElementType()); if (c != 0) return c; i++; r1--; r2--; int i2 = d2.readInt(); if (i1 == i2) { return compare(d, schema.getTypes().get(i1)); } else { return i1 - i2;
/** Compare binary encoded data. If equal, return zero. If greater-than, * return 1, if less than return -1. Order is consistent with that of {@link * org.apache.avro.generic.GenericData#compare(Object, Object, Schema)}.*/ public static int compare(byte[] b1, int s1, byte[] b2, int s2, Schema schema) { return compare(b1, s1, b1.length - s1, b2, s2, b2.length - s2, schema); }
continue; int c = compare(d, field.schema()); if (c != 0) return (field.order() != Field.Order.DESCENDING) ? c : -c; long l = Math.min(l1, l2); while (i < l) { // compare to end of block int c = compare(d, schema.getElementType()); if (c != 0) return c; i++; r1--; r2--; int i2 = d2.readInt(); if (i1 == i2) { return compare(d, schema.getTypes().get(i1)); } else { return i1 - i2;
/** Compare binary encoded data. If equal, return zero. If greater-than, * return 1, if less than return -1. Order is consistent with that of {@link * org.apache.avro.generic.GenericData#compare(Object, Object, Schema)}.*/ public static int compare(byte[] b1, int s1, byte[] b2, int s2, Schema schema) { return compare(b1, s1, b1.length - s1, b2, s2, b2.length - s2, schema); }
public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { return BinaryData.compare(b1, s1, l1, b2, s2, l2, schema); }
@Override public int compare(TetherData x, TetherData y) { ByteBuffer b1 = x.buffer(), b2 = y.buffer(); int diff = BinaryData.compare(b1.array(), b1.position(), b2.array(), b2.position(), schema); return diff == 0 ? -1 : diff; }
/** Compare binary encoded data. If equal, return zero. If greater-than, * return 1, if less than return -1. Order is consistent with that of {@link * org.apache.avro.generic.GenericData#compare(Object, Object, Schema)}.*/ public static int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2, Schema schema) { Decoders decoders = DECODERS.get(); decoders.set(b1, s1, l1, b2, s2, l2); try { return compare(decoders, schema); } catch (IOException e) { throw new AvroRuntimeException(e); } finally { decoders.clear(); } }
/** Compare binary encoded data. If equal, return zero. If greater-than, * return 1, if less than return -1. Order is consistent with that of {@link * org.apache.avro.generic.GenericData#compare(Object, Object, Schema)}.*/ public static int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2, Schema schema) { Decoders decoders = DECODERS.get(); decoders.set(b1, s1, l1, b2, s2, l2); try { return compare(decoders, schema); } catch (IOException e) { throw new AvroRuntimeException(e); } finally { decoders.clear(); } }
@Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int diff = BinaryData.compare(b1, BinaryData.skipLong(b1, s1), l1, b2, BinaryData.skipLong(b2, s2), l2, schema); return diff == 0 ? -1 : diff; }
@Test public void testNull() throws Exception { Schema schema = Schema.parse("\"null\""); byte[] b = render(null, schema, new GenericDatumWriter<>()); assertEquals(0, BinaryData.compare(b, 0, b, 0, schema)); }
b2.close(); assertEquals(-1, BinaryData.compare(b1.toByteArray(), start1, b2.toByteArray(), start2, record)); } catch (IOException e) { fail("IOException while writing records to output stream.");
/** {@inheritDoc} */ @Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { return BinaryData.compare(b1, s1, b2, s2, mSchema); }
@Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { return BinaryData.compare(b1, s1, l1, b2, s2, l2, schema); } }
@Override public int compare(byte[] arg0, int arg1, int arg2, byte[] arg3, int arg4, int arg5) { return -BinaryData.compare(arg0, arg1, arg2, arg3, arg4, arg5, schema); }
@Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { return BinaryData.compare(b1, s1, l1, b2, s2, l2, schema); } }
@Override public int compare(TetherData x, TetherData y) { ByteBuffer b1 = x.buffer(), b2 = y.buffer(); int diff = BinaryData.compare(b1.array(), b1.position(), b2.array(), b2.position(), schema); return diff == 0 ? -1 : diff; }
@Override public int compare(TetherData x, TetherData y) { ByteBuffer b1 = x.buffer(), b2 = y.buffer(); int diff = BinaryData.compare(b1.array(), b1.position(), b2.array(), b2.position(), schema); return diff == 0 ? -1 : diff; }
@Override public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { int diff = BinaryData.compare(b1, BinaryData.skipLong(b1, s1), l1, b2, BinaryData.skipLong(b2, s2), l2, schema); return diff == 0 ? -1 : diff; }