當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyValue.getQualifierLength方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.KeyValue.getQualifierLength方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyValue.getQualifierLength方法的具體用法?Java KeyValue.getQualifierLength怎麽用?Java KeyValue.getQualifierLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.KeyValue的用法示例。


在下文中一共展示了KeyValue.getQualifierLength方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prePut

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
@Override
public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put,
    final WALEdit edit, final Durability durability) throws IOException {
  byte[] attribute = put.getAttribute("visibility");
  byte[] cf = null;
  List<Cell> updatedCells = new ArrayList<Cell>();
  if (attribute != null) {
    for (List<? extends Cell> edits : put.getFamilyCellMap().values()) {
      for (Cell cell : edits) {
        KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
        if (cf == null) {
          cf = kv.getFamily();
        }
        Tag tag = new Tag(TAG_TYPE, attribute);
        List<Tag> tagList = new ArrayList<Tag>();
        tagList.add(tag);

        KeyValue newKV = new KeyValue(kv.getRow(), 0, kv.getRowLength(), kv.getFamily(), 0,
            kv.getFamilyLength(), kv.getQualifier(), 0, kv.getQualifierLength(),
            kv.getTimestamp(), KeyValue.Type.codeToType(kv.getType()), kv.getValue(), 0,
            kv.getValueLength(), tagList);
        ((List<Cell>) updatedCells).add(newKV);
      }
    }
    put.getFamilyCellMap().remove(cf);
    // Update the family map
    put.getFamilyCellMap().put(cf, updatedCells);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:30,代碼來源:TestReplicationWithTags.java

示例2: prePut

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
@Override
public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put m, WALEdit edit,
    Durability durability) throws IOException {
  byte[] attribute = m.getAttribute(NON_VISIBILITY);
  byte[] cf = null;
  List<Cell> updatedCells = new ArrayList<Cell>();
  if (attribute != null) {
    for (List<? extends Cell> edits : m.getFamilyCellMap().values()) {
      for (Cell cell : edits) {
        KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
        if (cf == null) {
          cf = kv.getFamily();
        }
        Tag tag = new Tag((byte) NON_VIS_TAG_TYPE, attribute);
        List<Tag> tagList = new ArrayList<Tag>();
        tagList.add(tag);
        tagList.addAll(kv.getTags());
        byte[] fromList = Tag.fromList(tagList);
        TagRewriteCell newcell = new TagRewriteCell(kv, fromList);
        KeyValue newKV = new KeyValue(kv.getRow(), 0, kv.getRowLength(), kv.getFamily(), 0,
            kv.getFamilyLength(), kv.getQualifier(), 0, kv.getQualifierLength(),
            kv.getTimestamp(), KeyValue.Type.codeToType(kv.getType()), kv.getValue(), 0,
            kv.getValueLength(), tagList);
        ((List<Cell>) updatedCells).add(newcell);
      }
    }
    m.getFamilyCellMap().remove(cf);
    // Update the family map
    m.getFamilyCellMap().put(cf, updatedCells);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:32,代碼來源:TestVisibilityLabelsReplication.java

示例3: updateMutationAddingTags

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
private void updateMutationAddingTags(final Mutation m) {
  byte[] attribute = m.getAttribute("visibility");
  byte[] cf = null;
  List<Cell> updatedCells = new ArrayList<Cell>();
  if (attribute != null) {
    for (List<? extends Cell> edits : m.getFamilyCellMap().values()) {
      for (Cell cell : edits) {
        KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
        if (cf == null) {
          cf = kv.getFamily();
        }
        Tag tag = new Tag((byte) 1, attribute);
        List<Tag> tagList = new ArrayList<Tag>();
        tagList.add(tag);

        KeyValue newKV = new KeyValue(kv.getRow(), 0, kv.getRowLength(), kv.getFamily(), 0,
            kv.getFamilyLength(), kv.getQualifier(), 0, kv.getQualifierLength(),
            kv.getTimestamp(), KeyValue.Type.codeToType(kv.getType()), kv.getValue(), 0,
            kv.getValueLength(), tagList);
        ((List<Cell>) updatedCells).add(newKV);
      }
    }
    m.getFamilyCellMap().remove(cf);
    // Update the family map
    m.getFamilyCellMap().put(cf, updatedCells);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:28,代碼來源:TestTags.java

示例4: IndexKeyValue

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
public IndexKeyValue(KeyValue kv) {
  this(kv.getBuffer(), kv.getRowOffset(), kv.getRowLength(), kv.getBuffer(), kv
      .getQualifierOffset(), kv.getQualifierLength(), kv.getBuffer(), kv.getValueOffset(), kv
      .getValueLength());
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:6,代碼來源:IndexKeyValue.java

示例5: needDeleteIndexData

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
/**
 * If you need to delete index data.
 *
 * @param delete
 * @param indexSpec
 * @return
 */
private boolean needDeleteIndexData(Delete delete, IndexSpecification indexSpec) {
  if (delete.isEmpty()) {
    return true;
  } else {

    if (indexSpec.getIndexType() == IndexType.CCIndex) {
      return true;
    }
    for (Map.Entry<byte[], List<KeyValue>> entry : delete.getFamilyMap().entrySet()) {
      for (KeyValue kv : entry.getValue()) {
        if (kv.getQualifierLength() == 0) // delete family
        {
          if (Bytes.compareTo(kv.getFamily(), indexSpec.getFamily()) == 0) {
            return true;
          }
          if (indexSpec.getIndexType() == IndexType.UDGIndex) {
            if (indexSpec.getAdditionMap().containsKey(kv.getFamily())) {
              return true;
            }
          }

        } else {
          if (Bytes.compareTo(kv.getFamily(), indexSpec.getFamily()) == 0
              && Bytes.compareTo(kv.getQualifier(), indexSpec.getQualifier()) == 0) {
            return true;
          }
          if (indexSpec.getIndexType() == IndexType.UDGIndex) {
            if (indexSpec.getAdditionMap().containsKey(kv.getFamily())) {
              Set<byte[]> qua = indexSpec.getAdditionMap().get(kv.getFamily());
              if (qua == null) {
                return true;
              } else {
                if (qua.contains(kv.getQualifier())) {
                  return true;
                }
              }
            }
          }
        }
      }
    }

  }
  return false;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:53,代碼來源:IndexTable.java


注:本文中的org.apache.hadoop.hbase.KeyValue.getQualifierLength方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。