本文整理了Java中org.apache.hadoop.util.bloom.Key.getBytes()
方法的一些代码示例,展示了Key.getBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Key.getBytes()
方法的具体详情如下:
包路径:org.apache.hadoop.util.bloom.Key
类名称:Key
方法名:getBytes
暂无
代码示例来源:origin: org.apache.hadoop/hadoop-common
@Override
public int compareTo(Key other) {
int result = this.bytes.length - other.getBytes().length;
for (int i = 0; result == 0 && i < bytes.length; i++) {
result = this.bytes[i] - other.bytes[i];
}
if (result == 0) {
result = (int)(this.weight - other.weight);
}
return result;
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
/**
* Hashes a specified key into several integers.
* @param k The specified key.
* @return The array of hashed values.
*/
public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0, initval = 0; i < nbHash; i++) {
initval = hashFunction.hash(b, initval);
result[i] = Math.abs(initval % maxValue);
}
return result;
}
}
代码示例来源:origin: apache/accumulo
@Override
public synchronized void append(org.apache.accumulo.core.data.Key key, Value val)
throws IOException {
writer.append(key, val);
Key bloomKey = transformer.transform(key);
if (bloomKey.getBytes().length > 0)
bloomFilter.add(bloomKey);
}
代码示例来源:origin: apache/accumulo
/**
* Checks if this {@link RFile} contains keys from this range. The membership test is performed
* using a Bloom filter, so the result has always non-zero probability of false positives.
*
* @param range
* range of keys to check
* @return false iff key doesn't exist, true if key probably exists.
*/
boolean probablyHasKey(Range range) {
if (bloomFilter == null) {
initiateLoad(maxLoadThreads);
if (bloomFilter == null)
return true;
}
Key bloomKey = transformer.transform(range);
if (bloomKey == null || bloomKey.getBytes().length == 0)
return true;
return bloomFilter.membershipTest(bloomKey);
}
代码示例来源:origin: io.hops/hadoop-common
@Override
public int compareTo(Key other) {
int result = this.bytes.length - other.getBytes().length;
for (int i = 0; result == 0 && i < bytes.length; i++) {
result = this.bytes[i] - other.bytes[i];
}
if (result == 0) {
result = (int)(this.weight - other.weight);
}
return result;
}
}
代码示例来源:origin: com.facebook.hadoop/hadoop-core
public int compareTo(Key other) {
int result = this.bytes.length - other.getBytes().length;
for (int i = 0; result == 0 && i < bytes.length; i++) {
result = this.bytes[i] - other.bytes[i];
}
if (result == 0) {
result = Double.valueOf(this.weight - other.weight).intValue();
}
return result;
}
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
@Override
public int compareTo(Key other) {
int result = this.bytes.length - other.getBytes().length;
for (int i = 0; result == 0 && i < bytes.length; i++) {
result = this.bytes[i] - other.bytes[i];
}
if (result == 0) {
result = Double.valueOf(this.weight - other.weight).intValue();
}
return result;
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
@Override
public int compareTo(Key other) {
int result = this.bytes.length - other.getBytes().length;
for (int i = 0; result == 0 && i < bytes.length; i++) {
result = this.bytes[i] - other.bytes[i];
}
if (result == 0) {
result = Double.valueOf(this.weight - other.weight).intValue();
}
return result;
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
@Override
public int compareTo(Key other) {
int result = this.bytes.length - other.getBytes().length;
for (int i = 0; result == 0 && i < bytes.length; i++) {
result = this.bytes[i] - other.bytes[i];
}
if (result == 0) {
result = Double.valueOf(this.weight - other.weight).intValue();
}
return result;
}
}
代码示例来源:origin: io.prestosql.hadoop/hadoop-apache
/**
* Hashes a specified key into several integers.
* @param k The specified key.
* @return The array of hashed values.
*/
public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0, initval = 0; i < nbHash; i++) {
initval = hashFunction.hash(b, initval);
result[i] = Math.abs(initval % maxValue);
}
return result;
}
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
/**
* Hashes a specified key into several integers.
* @param k The specified key.
* @return The array of hashed values.
*/
public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0, initval = 0; i < nbHash; i++) {
initval = hashFunction.hash(b, initval);
result[i] = Math.abs(initval % maxValue);
}
return result;
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
/**
* Hashes a specified key into several integers.
* @param k The specified key.
* @return The array of hashed values.
*/
public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0, initval = 0; i < nbHash; i++) {
initval = hashFunction.hash(b, initval);
result[i] = Math.abs(initval % maxValue);
}
return result;
}
}
代码示例来源:origin: com.facebook.hadoop/hadoop-core
/**
* Hashes a specified key into several integers.
* @param k The specified key.
* @return The array of hashed values.
*/
public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0, initval = 0; i < nbHash; i++) {
initval = hashFunction.hash(b, initval);
result[i] = Math.abs(initval % maxValue);
}
return result;
}
}
代码示例来源:origin: io.hops/hadoop-common
/**
* Hashes a specified key into several integers.
* @param k The specified key.
* @return The array of hashed values.
*/
public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0, initval = 0; i < nbHash; i++) {
initval = hashFunction.hash(b, initval);
result[i] = Math.abs(initval % maxValue);
}
return result;
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public synchronized void append(org.apache.accumulo.core.data.Key key, Value val)
throws IOException {
writer.append(key, val);
Key bloomKey = transformer.transform(key);
if (bloomKey.getBytes().length > 0)
bloomFilter.add(bloomKey);
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
/**
* Checks if this {@link RFile} contains keys from this range. The membership test is performed
* using a Bloom filter, so the result has always non-zero probability of false positives.
*
* @param range
* range of keys to check
* @return false iff key doesn't exist, true if key probably exists.
*/
boolean probablyHasKey(Range range) throws IOException {
if (bloomFilter == null) {
initiateLoad(maxLoadThreads);
if (bloomFilter == null)
return true;
}
Key bloomKey = transformer.transform(range);
if (bloomKey == null || bloomKey.getBytes().length == 0)
return true;
return bloomFilter.membershipTest(bloomKey);
}
内容来源于网络,如有侵权,请联系作者删除!