当前位置: 首页>>代码示例>>Java>>正文


Java IndexSpecification.getIndexColumns方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.index.IndexSpecification.getIndexColumns方法的典型用法代码示例。如果您正苦于以下问题:Java IndexSpecification.getIndexColumns方法的具体用法?Java IndexSpecification.getIndexColumns怎么用?Java IndexSpecification.getIndexColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.index.IndexSpecification的用法示例。


在下文中一共展示了IndexSpecification.getIndexColumns方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doGetAndGroupByTS

import org.apache.hadoop.hbase.index.IndexSpecification; //导入方法依赖的package包/类
private static Multimap<Long, Cell> doGetAndGroupByTS(List<IndexSpecification> indexSpecs,
    HRegion userRegion, Cell deleteKV, List<IndexSpecification> indicesToConsider)
    throws IOException {

  Get get = new Get(deleteKV.getRow());
  long maxTS = HConstants.LATEST_TIMESTAMP;

  if (deleteKV.getTimestamp() < maxTS) {
    // Add +1 to make the current get includes the timestamp
    maxTS = deleteKV.getTimestamp() + 1;
  }
  get.setTimeRange(0L, maxTS);

  for (IndexSpecification index : indexSpecs) {
    // Get all indices involves this family/qualifier
    if (index.contains(deleteKV.getFamily(), deleteKV.getQualifier())) {
      indicesToConsider.add(index);
      for (ColumnQualifier cq : index.getIndexColumns()) {
        get.addColumn(cq.getColumnFamily(), cq.getQualifier());
      }
    }
  }
  if (((KeyValue) deleteKV).isDeleteType()) {
    get.setMaxVersions(1);
  } else if (((KeyValue) deleteKV).isDeleteColumnOrFamily()) {
    get.setMaxVersions();
  }
  List<KeyValue> userKVs = userRegion.get(get).list();

  // Group KV based on timestamp
  Multimap<Long, Cell> groupedKV = HashMultimap.create();

  if (userKVs != null) {
    for (Cell userKV : userKVs) {
      groupedKV.put(userKV.getTimestamp(), userKV);
    }
  }
  return groupedKV;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:40,代码来源:IndexRegionObserver.java

示例2: isIndexSuitable

import org.apache.hadoop.hbase.index.IndexSpecification; //导入方法依赖的package包/类
private boolean isIndexSuitable(IndexSpecification index, List<Column> cols,
    Map<Column, LeafFilterNode> leafNodes) {
  int matchedCols = 0;
  for (ColumnQualifier cq : index.getIndexColumns()) {
    Column column = new Column(cq.getColumnFamily(), cq.getQualifier(), cq.getValuePartition());
    if (cols.contains(column)) {
      matchedCols++;
      // leafNodes.get(column) will never be null.. Don't worry
      if (leafNodes.get(column).getFilterColumnValueDetail() instanceof FilterColumnValueRange) {
        // When the condition on the column is a range condition, we need to ensure in this index
        // 1. The column is the last column
        // or
        // 2. There are no columns in this index which is part of the cols list
        if (matchedCols != cols.size()) {
          return false;
        }
      }
    } else {
      if (matchedCols != cols.size()) {
        return false;
      }
    }
    if (matchedCols == cols.size()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:29,代码来源:ScanFilterEvaluator.java

示例3: prepareIndexDelete

import org.apache.hadoop.hbase.index.IndexSpecification; //导入方法依赖的package包/类
public static Delete prepareIndexDelete(Delete userDelete, IndexSpecification index,
    byte[] indexRegionStartKey) throws IOException {
  ByteArrayBuilder indexRow =
      IndexUtils.getIndexRowKeyHeader(index, indexRegionStartKey, userDelete.getRow());
  boolean update = false;
  for (ColumnQualifier cq : index.getIndexColumns()) {
    Cell kvFound = null;
    for (Entry<byte[], List<Cell>> entry : userDelete.getFamilyCellMap().entrySet()) {
      for (Cell cell : entry.getValue()) {
        Cell kv = KeyValueUtil.ensureKeyValue(cell);
        if (Bytes.equals(cq.getColumnFamily(), kv.getFamily())
            && Bytes.equals(cq.getQualifier(), kv.getQualifier())) {
          kvFound = kv;
          update = true;
          break;
        }
      }
    }
    if (kvFound == null) {
      indexRow.position(indexRow.position() + cq.getMaxValueLength());
    } else {
      IndexUtils.updateRowKeyForKV(cq, kvFound, indexRow);
    }
  }
  if (update) {
    // Append the actual row key at the end of the index row key.
    indexRow.put(userDelete.getRow());
    Delete idxDelete = new Delete(indexRow.array());
    idxDelete.deleteColumn(Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL,
      userDelete.getTimeStamp());
    idxDelete.setDurability(Durability.SKIP_WAL);
    return idxDelete;
  }
  return null;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:36,代码来源:IndexUtils.java

示例4: getIndexDeletes

import org.apache.hadoop.hbase.index.IndexSpecification; //导入方法依赖的package包/类
private static Collection<Delete> getIndexDeletes(List<IndexSpecification> indexSpecs,
    HRegion userRegion, HRegion indexRegion, Cell deleteKV) throws IOException {
  Collection<Delete> indexDeletes = new LinkedHashSet<Delete>();
  List<IndexSpecification> indicesToUpdate = new LinkedList<IndexSpecification>();
  Multimap<Long, Cell> groupedKV =
      doGetAndGroupByTS(indexSpecs, userRegion, deleteKV, indicesToUpdate);

  // There can be multiple index kvs for each user kv
  // So, prepare all resultant index delete kvs for this user delete kv
  for (Entry<Long, Collection<Cell>> entry : groupedKV.asMap().entrySet()) {
    for (IndexSpecification index : indicesToUpdate) {
      ByteArrayBuilder indexRow =
          IndexUtils.getIndexRowKeyHeader(index, indexRegion.getStartKey(), deleteKV.getRow());
      boolean update = false;
      for (ColumnQualifier cq : index.getIndexColumns()) {
        Cell kvFound = null;
        for (Cell kv : entry.getValue()) {
          if (Bytes.equals(cq.getColumnFamily(), kv.getFamily())
              && Bytes.equals(cq.getQualifier(), kv.getQualifier())) {
            kvFound = kv;
            update = true;
            break;
          }
        }
        if (kvFound == null) {
          indexRow.position(indexRow.position() + cq.getMaxValueLength());
        } else {
          IndexUtils.updateRowKeyForKV(cq, kvFound, indexRow);
        }
      }
      if (update) {
        // Append the actual row key at the end of the index row key.
        indexRow.put(deleteKV.getRow());
        Delete idxDelete = new Delete(indexRow.array());
        if (((KeyValue) deleteKV).isDeleteType()) {
          idxDelete
              .deleteColumn(Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, entry.getKey());
        } else {
          idxDelete.deleteFamily(Constants.IDX_COL_FAMILY, entry.getKey());
        }
        indexDeletes.add(idxDelete);
      }
    }
  }
  return indexDeletes;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:47,代码来源:IndexRegionObserver.java


注:本文中的org.apache.hadoop.hbase.index.IndexSpecification.getIndexColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。