org.apache.hadoop.hbase.client.Get.getFamilyMap()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中org.apache.hadoop.hbase.client.Get.getFamilyMap()方法的一些代码示例,展示了Get.getFamilyMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Get.getFamilyMap()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Get
类名称:Get
方法名:getFamilyMap

Get.getFamilyMap介绍

[英]Method for retrieving the get's familyMap
[中]用于检索get的familyMap的方法

代码示例

代码示例来源:origin: apache/kylin

kvs = toKeyValue(row, data.get(row), get.getMaxVersions());
} else {
  for (byte[] family : get.getFamilyMap().keySet()) {
    if (data.get(row).get(family) == null)
      continue;
    NavigableSet<byte[]> qualifiers = get.getFamilyMap().get(family);
    if (qualifiers == null || qualifiers.isEmpty())
      qualifiers = data.get(row).get(family).navigableKeySet();

代码示例来源:origin: apache/hbase

@Test
public void testNullQualifier() {
 Get get = new Get(ROW);
 byte[] family = Bytes.toBytes("family");
 get.addColumn(family, null);
 Set<byte[]> qualifiers = get.getFamilyMap().get(family);
 Assert.assertEquals(1, qualifiers.size());
}

代码示例来源:origin: apache/hbase

/**
 * Do a small get/scan against one store. This is required because store
 * has no actual methods of querying itself, and relies on StoreScanner.
 */
public static List<Cell> getFromStoreFile(HStore store,
                       byte [] row,
                       NavigableSet<byte[]> columns
                       ) throws IOException {
 Get get = new Get(row);
 Map<byte[], NavigableSet<byte[]>> s = get.getFamilyMap();
 s.put(store.getColumnFamilyDescriptor().getName(), columns);
 return getFromStoreFile(store,get);
}

代码示例来源:origin: apache/hbase

@Override
public Result get(Get get) throws IOException {
 TimeRange range = get.getTimeRange();
 String spec = buildRowSpec(get.getRow(), get.getFamilyMap(),
  range.getMin(), range.getMax(), get.getMaxVersions());
 if (get.getFilter() != null) {
  LOG.warn("filters not supported on gets");
 }
 Result[] results = getResults(spec);
 if (results.length > 0) {
  if (results.length > 1) {
   LOG.warn("too many results for get (" + results.length + ")");
  }
  return results[0];
 } else {
  return new Result();
 }
}

代码示例来源:origin: apache/hbase

NavigableMap<byte[], NavigableMap<byte[], MutableLong>> sums =
  new TreeMap<>(Bytes.BYTES_COMPARATOR);
get.getFamilyMap().forEach((cf, cqs) -> {
 NavigableMap<byte[], MutableLong> ss = new TreeMap<>(Bytes.BYTES_COMPARATOR);
 sums.put(cf, ss);

代码示例来源:origin: apache/hbase

@Test
public void testMatchWhenFilterReturnsIncludeAndSeekNextRow() throws IOException {
 List<MatchCode> expected = new ArrayList<>();
 expected.add(ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_ROW);
 expected.add(ScanQueryMatcher.MatchCode.DONE);
 Scan scanWithFilter = new Scan(scan).setFilter(new AlwaysIncludeAndSeekNextRowFilter());
 long now = EnvironmentEdgeManager.currentTime();
 // scan with column 2,4,5
 UserScanQueryMatcher qm = UserScanQueryMatcher.create(
  scanWithFilter, new ScanInfo(this.conf, fam2, 0, 1, ttl, KeepDeletedCells.FALSE,
    HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
  get.getFamilyMap().get(fam2), now - ttl, now, null);
 List<KeyValue> memstore = new ArrayList<>();
 // ColumnTracker will return INCLUDE_AND_SEEK_NEXT_COL , and filter will return
 // INCLUDE_AND_SEEK_NEXT_ROW, so final match code will be INCLUDE_AND_SEEK_NEXT_ROW.
 memstore.add(new KeyValue(row1, fam2, col2, 1, data));
 memstore.add(new KeyValue(row2, fam1, col1, data));
 List<ScanQueryMatcher.MatchCode> actual = new ArrayList<>(memstore.size());
 KeyValue k = memstore.get(0);
 qm.setToNewRow(k);
 for (KeyValue kv : memstore) {
  actual.add(qm.match(kv));
 }
 assertEquals(expected.size(), actual.size());
 for (int i = 0; i < expected.size(); i++) {
  LOG.debug("expected " + expected.get(i) + ", actual " + actual.get(i));
  assertEquals(expected.get(i), actual.get(i));
 }
}

代码示例来源:origin: apache/hbase

scan, new ScanInfo(this.conf, fam2, 0, 1, ttl, KeepDeletedCells.FALSE,
  HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
get.getFamilyMap().get(fam2), now - ttl, now, null);

代码示例来源:origin: apache/hbase

this.checkExistenceOnly = get.isCheckExistenceOnly();
this.loadColumnFamiliesOnDemand = get.getLoadColumnFamiliesOnDemandValue();
Map<byte[], NavigableSet<byte[]>> fams = get.getFamilyMap();
for (Map.Entry<byte[],NavigableSet<byte[]>> entry : fams.entrySet()) {
 byte [] fam = entry.getKey();

代码示例来源:origin: apache/hbase

this.storeOffset = get.getRowOffsetPerColumnFamily();
this.tr = get.getTimeRange();
this.familyMap = get.getFamilyMap();
this.asyncPrefetch = false;
this.consistency = get.getConsistency();

代码示例来源:origin: apache/hbase

scanWithFilter, new ScanInfo(this.conf, fam2, 0, 5, ttl, KeepDeletedCells.FALSE,
  HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
get.getFamilyMap().get(fam2), now - ttl, now, null);

代码示例来源:origin: apache/hbase

scanWithFilter, new ScanInfo(this.conf, fam2, 0, 3, ttl, KeepDeletedCells.FALSE,
  HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
get.getFamilyMap().get(fam2), now - ttl, now, null);
scanWithFilter, new ScanInfo(this.conf, fam2, 0, 2, ttl, KeepDeletedCells.FALSE,
  HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
get.getFamilyMap().get(fam2), now - ttl, now, null);

代码示例来源:origin: apache/hbase

@Test public void testGet() throws Exception{
 byte[] row = "row".getBytes();
 byte[] fam = "fam".getBytes();
 byte[] qf1 = "qf1".getBytes();
 long ts = System.currentTimeMillis();
 int maxVersions = 2;
 Get get = new Get(row);
 get.addColumn(fam, qf1);
 get.setTimeRange(ts, ts+1);
 get.setMaxVersions(maxVersions);
 ClientProtos.Get getProto = ProtobufUtil.toGet(get);
 Get desGet = ProtobufUtil.toGet(getProto);
 assertTrue(Bytes.equals(get.getRow(), desGet.getRow()));
 Set<byte[]> set = null;
 Set<byte[]> desSet = null;
 for(Map.Entry<byte[], NavigableSet<byte[]>> entry :
   get.getFamilyMap().entrySet()){
  assertTrue(desGet.getFamilyMap().containsKey(entry.getKey()));
  set = entry.getValue();
  desSet = desGet.getFamilyMap().get(entry.getKey());
  for(byte [] qualifier : set){
   assertTrue(desSet.contains(qualifier));
  }
 }
 assertEquals(get.getMaxVersions(), desGet.getMaxVersions());
 TimeRange tr = get.getTimeRange();
 TimeRange desTr = desGet.getTimeRange();
 assertEquals(tr.getMax(), desTr.getMax());
 assertEquals(tr.getMin(), desTr.getMin());
}

代码示例来源:origin: apache/hbase

out.setStoreOffset(in.getRowOffsetPerColumnFamily());
out.setExistence_only(in.isCheckExistenceOnly());
for (Map.Entry<byte[], NavigableSet<byte[]>> family : in.getFamilyMap().entrySet()) {

代码示例来源:origin: apache/hbase

new ScanInfo(this.conf, fam2, 0, 1, testTTL, KeepDeletedCells.FALSE,
  HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
get.getFamilyMap().get(fam2), now - testTTL, now, null);

代码示例来源:origin: apache/hbase

/**
 * This is a cryptic test. It is checking that we don't include a fake cell, one that has a
 * timestamp of {@link HConstants#OLDEST_TIMESTAMP}. See HBASE-16074 for background.
 * @throws IOException
 */
@Test
public void testNeverIncludeFakeCell() throws IOException {
 long now = EnvironmentEdgeManager.currentTime();
 // Do with fam2 which has a col2 qualifier.
 UserScanQueryMatcher qm = UserScanQueryMatcher.create(scan,
  new ScanInfo(this.conf, fam2, 10, 1, ttl, KeepDeletedCells.FALSE,
    HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
  get.getFamilyMap().get(fam2), now - ttl, now, null);
 Cell kv = new KeyValue(row1, fam2, col2, 1, data);
 Cell cell = PrivateCellUtil.createLastOnRowCol(kv);
 qm.setToNewRow(kv);
 MatchCode code = qm.match(cell);
 assertFalse(code.compareTo(MatchCode.SEEK_NEXT_COL) != 0);
}

代码示例来源:origin: apache/hbase

Map<byte[], NavigableSet<byte[]>> families = get.getFamilyMap();
for (Map.Entry<byte[], NavigableSet<byte[]>> family: families.entrySet()) {
 NavigableSet<byte[]> qualifiers = family.getValue();

代码示例来源:origin: apache/hbase

Map<byte[], NavigableSet<byte[]>> families = get.getFamilyMap();
for (Map.Entry<byte[], NavigableSet<byte[]>> family: families.entrySet()) {
 NavigableSet<byte[]> qualifiers = family.getValue();

代码示例来源:origin: apache/hbase

case GET:
case EXISTS:
 families = ((Get)query).getFamilyMap();
 break;
case SCAN:

代码示例来源:origin: org.apache.hbase/hbase-client

@Test
public void testNullQualifier() {
 Get get = new Get(ROW);
 byte[] family = Bytes.toBytes("family");
 get.addColumn(family, null);
 Set<byte[]> qualifiers = get.getFamilyMap().get(family);
 Assert.assertEquals(1, qualifiers.size());
}

代码示例来源:origin: apache/metron

@Override
public boolean exists(Get get) throws IOException {
 if(get.getFamilyMap() == null || get.getFamilyMap().size() == 0) {
  return data.containsKey(get.getRow());
 } else {
  byte[] row = get.getRow();
  if(!data.containsKey(row)) {
   return false;
  }
  for(byte[] family : get.getFamilyMap().keySet()) {
   if(!data.get(row).containsKey(family)) {
    return false;
   } else {
    return true;
   }
  }
  return true;
 }
}

相关文章