Java Code Examples for org.apache.hadoop.hbase.util.Bytes#hashCode()

The following examples show how to use org.apache.hadoop.hbase.util.Bytes#hashCode() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: geowave   File: PartialCellEquality.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public int hashCode() {
  final int familyHash =
      Bytes.hashCode(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());
  final int qualifierHash =
      Bytes.hashCode(
          cell.getQualifierArray(),
          cell.getQualifierOffset(),
          cell.getQualifierLength());

  // combine the sub-hashes
  final int hash = (31 * familyHash) + qualifierHash;
  if (!includeTags) {
    return hash;
  }
  final int tagsHash =
      Bytes.hashCode(cell.getTagsArray(), cell.getTagsOffset(), cell.getTagsLength());
  return (31 * hash) + tagsHash;
}
 
Example 2
private static int calcHashCode(String familyString, byte[] qualifier) {
  final int prime = 31;
  int result = 1;
  result = prime * result + familyString.hashCode();
  if (qualifier != null) {
    result = prime * result + Bytes.hashCode(qualifier);
  }
  return result;
}
 
Example 3
Source Project: phoenix   File: ColumnReference.java    License: Apache License 2.0 5 votes vote down vote up
private static int calcHashCode(byte[] family, byte[] qualifier) {
  final int prime = 31;
  int result = 1;
  result = prime * result + Bytes.hashCode(family);
  result = prime * result + Bytes.hashCode(qualifier);
  return result;
}
 
Example 4
private static int calcHashCode(byte[] family, byte[] qualifier) {
  final int prime = 31;
  int result = 1;
  result = prime * result + Bytes.hashCode(family);
  result = prime * result + Bytes.hashCode(qualifier);
  return result;
}
 
Example 5
Source Project: hbase   File: WALKeyImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  int result = Bytes.hashCode(this.encodedRegionName);
  result = (int) (result ^ getSequenceId());
  result = (int) (result ^ this.writeTime);
  return result;
}
 
Example 6
Source Project: hbase   File: TablePermission.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  final int prime = 37;
  int result = super.hashCode();
  if (table != null) {
    result = prime * result + table.hashCode();
  }
  if (family != null) {
    result = prime * result + Bytes.hashCode(family);
  }
  if (qualifier != null) {
    result = prime * result + Bytes.hashCode(qualifier);
  }
  return result;
}
 
Example 7
Source Project: geowave   File: HBaseBulkDeleteEndpoint.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  int h = 31;
  h = h + (13 * Bytes.hashCode(family));
  h = h + (13 * Bytes.hashCode(qualifier));
  return h;
}
 
Example 8
@Override
public int hashCode() {
  int result = Bytes.hashCode(name);
  result ^= (int) COLUMN_DESCRIPTOR_VERSION;
  result ^= values.hashCode();
  result ^= configuration.hashCode();
  return result;
}
 
Example 9
Source Project: hbase   File: KeyValue.java    License: Apache License 2.0 5 votes vote down vote up
private int calculateHashForKey(Cell cell) {
  // pre-calculate the 3 hashes made of byte ranges
  int rowHash = Bytes.hashCode(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
  int familyHash = Bytes.hashCode(cell.getFamilyArray(), cell.getFamilyOffset(),
      cell.getFamilyLength());
  int qualifierHash = Bytes.hashCode(cell.getQualifierArray(), cell.getQualifierOffset(),
      cell.getQualifierLength());

  // combine the 6 sub-hashes
  int hash = 31 * rowHash + familyHash;
  hash = 31 * hash + qualifierHash;
  hash = 31 * hash + (int) cell.getTimestamp();
  hash = 31 * hash + cell.getTypeByte();
  return hash;
}
 
Example 10
Source Project: hbase   File: BulkDeleteEndpoint.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  int h = 31;
  h = h + 13 * Bytes.hashCode(this.family);
  h = h + 13 * Bytes.hashCode(this.qualifier);
  return h;
}
 
Example 11
private long getUniqueTimestamp(byte[] row) {
  int slot = Bytes.hashCode(row) & mask;
  MutableLong lastTimestamp = lastTimestamps[slot];
  long now = System.currentTimeMillis();
  synchronized (lastTimestamp) {
    long pt = lastTimestamp.longValue() >> 10;
    if (now > pt) {
      lastTimestamp.setValue(now << 10);
    } else {
      lastTimestamp.increment();
    }
    return lastTimestamp.longValue();
  }
}
 
Example 12
Source Project: phoenix   File: CoveredColumn.java    License: Apache License 2.0 5 votes vote down vote up
private static int calcHashCode(String familyString, byte[] qualifier) {
  final int prime = 31;
  int result = 1;
  result = prime * result + familyString.hashCode();
  if (qualifier != null) {
    result = prime * result + Bytes.hashCode(qualifier);
  }
  return result;
}
 
Example 13
Source Project: hbase   File: AsyncNonMetaRegionLocator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(row) ^ locateType.hashCode();
}
 
Example 14
Source Project: hbase   File: PrefixFilter.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(this.getPrefix());
}
 
Example 15
Source Project: hbase   File: InclusiveStopFilter.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(this.stopRowKey);
}
 
Example 16
Source Project: hbase   File: ColumnPrefixFilter.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(this.getPrefix());
}
 
Example 17
Source Project: hbase   File: ZKUtil.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  int ret = 17 + getPath().hashCode() * 31;
  return ret * 31 + Bytes.hashCode(data);
}
 
Example 18
Source Project: hbase   File: ZKUtil.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  int ret = getPath().hashCode();
  ret = ret * 31 + Bytes.hashCode(data);
  return ret * 31 + Integer.hashCode(version);
}
 
Example 19
Source Project: hbase   File: LRUDictionary.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(container, offset, length);
}
 
Example 20
Source Project: Kylin   File: ByteArray.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Bytes.hashCode(data);
}