当前位置: 首页>>代码示例>>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;未经允许,请勿转载。