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

x33g5p2x  于2022-01-26 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(171)

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

Put.get介绍

[英]Returns a list of all KeyValue objects with matching column family and qualifier.
[中]返回具有匹配列族和限定符的所有KeyValue对象的列表。

代码示例

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

@Test
public void testPutCreationWithByteBuffer() {
 Put p = new Put(ROW);
 List<Cell> c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(0, c.size());
 Assert.assertEquals(HConstants.LATEST_TIMESTAMP, p.getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(1984L, c.get(0).getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(2013L, c.get(0).getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(2001L, c.get(0).getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(2001L, c.get(0).getTimestamp());

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

private int getInteger(Put p, byte[] family, byte[] qualifier) {
  List<Cell> cells = p.get(family, qualifier);
  if (cells != null && cells.size() > 0) {
    Cell cell = cells.get(0);
    return (Integer)PInteger.INSTANCE.toObject(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
  }
  return 0;
}

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

@Test
public void testTaggingAPutWrongQualifier() throws Exception {
  Put put = generateOriginalPut();
  Cell initialCell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0);
  // Different qualifier, so no tags should be set
  MetaDataUtil.conditionallyAddTagsToPutCells(put, TABLE_FAMILY_BYTES, EMPTY_BYTE_ARRAY,
      mockBuilder, EMPTY_BYTE_ARRAY, DUMMY_TAGS);
  verify(mockBuilder, never()).setTags(Mockito.any(byte[].class));
  Cell newCell = put.getFamilyCellMap().get(TABLE_FAMILY_BYTES).get(0);
  assertEquals(initialCell, newCell);
  assertNull(TagUtil.carryForwardTags(newCell));
}

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

columnToBeAdded.get(PhoenixDatabaseMetaData.TABLE_FAMILY_BYTES,
      PhoenixDatabaseMetaData.KEY_SEQ_BYTES);
if (keySeqCells != null && keySeqCells.size() > 0) {

代码示例来源:origin: forcedotcom/phoenix

expectedKvs.addAll(allKvs);
allKvs.addAll(0, p.get(family, qual));
codec.verifiers.add(new ListMatchingVerifier("cleanup state 2", expectedKvs, familyRef));
codec.verifiers.add(new ListMatchingVerifier("put state 2", allKvs, familyRef));

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

@Test
public void testSkipTaggingAPutDueToSameCellValue() throws Exception {
  Put put = generateOriginalPut();
  Cell initialCell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0);
  // valueArray is set as the value stored in the cell, so we skip tagging the cell
  MetaDataUtil.conditionallyAddTagsToPutCells(put, TABLE_FAMILY_BYTES, QUALIFIER,
      mockBuilder, ORIGINAL_VALUE, DUMMY_TAGS);
  verify(mockBuilder, never()).setTags(Mockito.any(byte[].class));
  Cell newCell = put.getFamilyCellMap().get(TABLE_FAMILY_BYTES).get(0);
  assertEquals(initialCell, newCell);
  assertNull(TagUtil.carryForwardTags(newCell));
}

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

Cell cell0 = put.get(family, qualifier0).get(0);
Cell cell1 = put.get(family, qualifier1).get(0);

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

private boolean switchAttribute(PTable table, boolean currAttribute, List<Mutation> tableMetaData, byte[] attrQualifier) {
  for (Mutation m : tableMetaData) {
    if (m instanceof Put) {
      Put p = (Put)m;
      List<Cell> cells = p.get(TABLE_FAMILY_BYTES, attrQualifier);
      if (cells != null && cells.size() > 0) {
        Cell cell = cells.get(0);
        boolean newAttribute = (boolean)PBoolean.INSTANCE.toObject(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
        return currAttribute != newAttribute;
      }
    }
  }
  return false;
}

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

@Test
public void testPutCreationWithByteBuffer() {
 Put p = new Put(ROW);
 List<Cell> c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(0, c.size());
 Assert.assertEquals(HConstants.LATEST_TIMESTAMP, p.getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(1984L, c.get(0).getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(2013L, c.get(0).getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(2001L, c.get(0).getTimestamp());
 c = p.get(FAMILY, QUALIFIER);
 Assert.assertEquals(1, c.size());
 Assert.assertEquals(2001L, c.get(0).getTimestamp());

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

for (Cell c : put.get(FAMILY, COLUMN)) {
 writer.append(c);

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

Cell cell0 = put.get(family, qualifier0).get(0);
Cell cell1 = put.get(family, qualifier1).get(0);

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

@Test
public void testMutatingAPut() throws Exception {
  Put put = generateOriginalPut();
  byte[] newValue = Bytes.toBytes("new-value");
  Cell cell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0);
  assertEquals(Bytes.toString(ORIGINAL_VALUE),
      Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
  MetaDataUtil.mutatePutValue(put, TABLE_FAMILY_BYTES, QUALIFIER, newValue);
  cell = put.get(TABLE_FAMILY_BYTES, QUALIFIER).get(0);
  assertEquals(Bytes.toString(newValue),
      Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
}

代码示例来源:origin: forcedotcom/phoenix

LocalTableState table = new LocalTableState(env, state, m);
table.addPendingUpdates(m.get(fam, qual));
assertEquals("Didn't get the pending mutation's value first", m.get(fam, qual).get(0), s.next());

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

LocalTableState table = new LocalTableState(state, m);
table.addPendingUpdates(m.get(fam, qual));
assertEquals("Didn't get the pending mutation's value first", m.get(fam, qual).get(0), s.next());

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

LocalTableState table = new LocalTableState(state, m);
table.addPendingUpdates(m.get(fam, qual));

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

LocalTableState table = new LocalTableState(state, m);
table.addPendingUpdates(m.get(fam, qual));
assertEquals("Didn't get the pending mutation's value first", m.get(fam, qual).get(0), s.next());

代码示例来源:origin: forcedotcom/phoenix

LocalTableState table = new LocalTableState(env, state, m);
KeyValue kv = m.get(fam, qual).get(0);
kv.setMemstoreTS(0);
table.addPendingUpdates(kv);

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

LocalTableState table = new LocalTableState(state, m);
KeyValue kv = PhoenixKeyValueUtil.maybeCopyCell(m.get(fam, qual).get(0));
kv.setSequenceId(0);
table.addPendingUpdates(kv);

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

private int getInteger(Put p, byte[] family, byte[] qualifier) {
  List<Cell> cells = p.get(family, qualifier);
  if (cells != null && cells.size() > 0) {
    Cell cell = cells.get(0);
    return (Integer)PInteger.INSTANCE.toObject(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
  }
  return 0;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

private boolean switchAttribute(PTable table, boolean currAttribute, List<Mutation> tableMetaData, byte[] attrQualifier) {
  for (Mutation m : tableMetaData) {
    if (m instanceof Put) {
      Put p = (Put)m;
      List<Cell> cells = p.get(TABLE_FAMILY_BYTES, attrQualifier);
      if (cells != null && cells.size() > 0) {
        Cell cell = cells.get(0);
        boolean newAttribute = (boolean)PBoolean.INSTANCE.toObject(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
        return currAttribute != newAttribute;
      }
    }
  }
  return false;
}

相关文章