/** Hash binary encoded data. Consistent with {@link * org.apache.avro.generic.GenericData#hashCode(Object, Schema)}.*/ public static int hashCode(byte[] bytes, int start, int length, Schema schema) { HashData data = HASH_DATA.get(); data.set(bytes, start, length); try { return hashCode(data, schema); } catch (IOException e) { throw new AvroRuntimeException(e); } }
public int getPartition(TetherData key, NullWritable value, int numPartitions) { Integer result = CACHE.get(); if (result != null) // return cached value return result; ByteBuffer b = key.buffer(); int p = b.position(); int hashCode = BinaryData.hashCode(b.array(), p, b.limit()-p, schema); if (hashCode < 0) hashCode = -hashCode; return hashCode % numPartitions; }
/** Hash binary encoded data. Consistent with {@link * org.apache.avro.generic.GenericData#hashCode(Object, Schema)}.*/ public static int hashCode(byte[] bytes, int start, int length, Schema schema) { HashData data = HASH_DATA.get(); data.set(bytes, start, length); try { return hashCode(data, schema); } catch (IOException e) { throw new AvroRuntimeException(e); } }
continue; hashCode = hashCode*31 + hashCode(data, field.schema()); for (long l = decoder.readArrayStart(); l != 0; l = decoder.arrayNext()) for (long i = 0; i < l; i++) hashCode = hashCode*31 + hashCode(data, elementType); return hashCode; throw new AvroRuntimeException("Can't hashCode maps!"); case UNION: return hashCode(data, schema.getTypes().get(decoder.readInt())); case FIXED: return hashBytes(1, data, schema.getFixedSize(), false);
continue; hashCode = hashCode*31 + hashCode(data, field.schema()); for (long l = decoder.readArrayStart(); l != 0; l = decoder.arrayNext()) for (long i = 0; i < l; i++) hashCode = hashCode*31 + hashCode(data, elementType); return hashCode; throw new AvroRuntimeException("Can't hashCode maps!"); case UNION: return hashCode(data, schema.getTypes().get(decoder.readInt())); case FIXED: return hashBytes(1, data, schema.getFixedSize(), false);
public int getPartition(TetherData key, NullWritable value, int numPartitions) { Integer result = CACHE.get(); if (result != null) // return cached value return result; ByteBuffer b = key.buffer(); int p = b.position(); int hashCode = BinaryData.hashCode(b.array(), p, b.limit()-p, schema); if (hashCode < 0) hashCode = -hashCode; return hashCode % numPartitions; }
public int getPartition(TetherData key, NullWritable value, int numPartitions) { Integer result = CACHE.get(); if (result != null) // return cached value return result; ByteBuffer b = key.buffer(); int p = b.position(); int hashCode = BinaryData.hashCode(b.array(), p, b.limit()-p, schema); if (hashCode < 0) hashCode = -hashCode; return hashCode % numPartitions; }
/** Hash binary encoded data. Consistent with {@link * org.apache.avro.generic.GenericData#hashCode(Object, Schema)}.*/ public static int hashCode(byte[] bytes, int start, int length, Schema schema) { HashData data = HASH_DATA.get(); data.set(bytes, start, length); try { return hashCode(data, schema); } catch (IOException e) { throw new AvroRuntimeException(e); } }
/** Hash binary encoded data. Consistent with {@link * org.apache.avro.generic.GenericData#hashCode(Object, Schema)}.*/ public static int hashCode(byte[] bytes, int start, int length, Schema schema) { HashData data = HASH_DATA.get(); data.set(bytes, start, length); try { return hashCode(data, schema); } catch (IOException e) { throw new AvroRuntimeException(e); } }
@Override int hashCode(byte[] value) { return BinaryData.hashCode(value, 0, value.length, getSchema()); }
/** Hash binary encoded data. Consistent with {@link * org.apache.avro.generic.GenericData#hashCode(Object, Schema)}.*/ public static int hashCode(byte[] bytes, int start, int length, Schema schema) { HashData data = HASH_DATA.get(); data.set(bytes, start, length); try { return hashCode(data, schema); } catch (IOException e) { throw new AvroRuntimeException(e); } }
@Override int hashCode(byte[] value) { return BinaryData.hashCode(value, 0, value.length, getSchema()); }
continue; hashCode = hashCode*31 + hashCode(data, field.schema()); for (long l = decoder.readArrayStart(); l != 0; l = decoder.arrayNext()) for (long i = 0; i < l; i++) hashCode = hashCode*31 + hashCode(data, elementType); return hashCode; throw new AvroRuntimeException("Can't hashCode maps!"); case UNION: return hashCode(data, schema.getTypes().get(decoder.readInt())); case FIXED: return hashBytes(1, data, schema.getFixedSize(), false);
continue; hashCode = hashCode*31 + hashCode(data, field.schema()); for (long l = decoder.readArrayStart(); l != 0; l = decoder.arrayNext()) for (long i = 0; i < l; i++) hashCode = hashCode*31 + hashCode(data, elementType); return hashCode; throw new AvroRuntimeException("Can't hashCode maps!"); case UNION: return hashCode(data, schema.getTypes().get(decoder.readInt())); case FIXED: return hashBytes(1, data, schema.getFixedSize(), false);
continue; hashCode = hashCode*31 + hashCode(data, field.schema()); for (long l = decoder.readArrayStart(); l != 0; l = decoder.arrayNext()) for (long i = 0; i < l; i++) hashCode = hashCode*31 + hashCode(data, elementType); return hashCode; throw new AvroRuntimeException("Can't hashCode maps!"); case UNION: return hashCode(data, schema.getTypes().get(decoder.readInt())); case FIXED: return hashBytes(1, data, schema.getFixedSize(), false);