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() . 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 check out the related API usage on the sidebar.
Example 1
Source File: PartialCellEquality.java    From geowave with 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
Source File: ColumnReference.java    From phoenix with 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 3
Source File: CoveredColumn.java    From phoenix with 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 4
Source File: WriteHeavyIncrementObserver.java    From hbase with Apache License 2.0 5 votes vote down vote up
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 5
Source File: BulkDeleteEndpoint.java    From hbase with 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 6
Source File: KeyValue.java    From hbase with 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 7
Source File: ColumnFamilyDescriptorBuilder.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  int result = Bytes.hashCode(name);
  result ^= (int) COLUMN_DESCRIPTOR_VERSION;
  result ^= values.hashCode();
  result ^= configuration.hashCode();
  return result;
}
 
Example 8
Source File: HBaseBulkDeleteEndpoint.java    From geowave with 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 9
Source File: TablePermission.java    From hbase with 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 10
Source File: WALKeyImpl.java    From hbase with 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 11
Source File: ColumnReference.java    From phoenix with BSD 3-Clause "New" or "Revised" License 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 12
Source File: CoveredColumn.java    From phoenix with BSD 3-Clause "New" or "Revised" License 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 File: PrefixFilter.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(this.getPrefix());
}
 
Example 14
Source File: InclusiveStopFilter.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(this.stopRowKey);
}
 
Example 15
Source File: ColumnPrefixFilter.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(this.getPrefix());
}
 
Example 16
Source File: ZKUtil.java    From hbase with 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 17
Source File: ZKUtil.java    From hbase with 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 18
Source File: AsyncNonMetaRegionLocator.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(row) ^ locateType.hashCode();
}
 
Example 19
Source File: LRUDictionary.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  return Bytes.hashCode(container, offset, length);
}
 
Example 20
Source File: ByteArray.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Bytes.hashCode(data);
}