org.apache.hadoop.hbase.Cell.getType()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(134)

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

Cell.getType介绍

[英]Returns the type of cell in a human readable format using Type. Note : This does not expose the internal types of Cells like KeyValue.Type#Maximum and KeyValue.Type#Minimum
[中]使用type以人类可读的格式返回单元格类型。注意:这不会公开诸如KeyValue之类的单元格的内部类型。输入#最大值和键值。类型#最小值

代码示例

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

@Override
public Type getType() {
 return cell.getType();
}

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

@Test
public void testGetType() throws IOException {
 Cell c = Mockito.mock(Cell.class);
 Mockito.when(c.getType()).thenCallRealMethod();
 for (Cell.Type type : Cell.Type.values()) {
  Mockito.when(c.getTypeByte()).thenReturn(type.getCode());
  assertEquals(type, c.getType());
 }
 try {
  Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode());
  c.getType();
  fail("The code of Maximum can't be handled by Cell.Type");
 } catch(UnsupportedOperationException e) {
 }
 try {
  Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode());
  c.getType();
  fail("The code of Maximum can't be handled by Cell.Type");
 } catch(UnsupportedOperationException e) {
 }
}

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

@Test
public void testGetType() throws IOException {
 Cell c = Mockito.mock(Cell.class);
 Mockito.when(c.getType()).thenCallRealMethod();
 for (Cell.Type type : Cell.Type.values()) {
  Mockito.when(c.getTypeByte()).thenReturn(type.getCode());
  assertEquals(type, c.getType());
 }
 try {
  Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode());
  c.getType();
  fail("The code of Maximum can't be handled by Cell.Type");
 } catch(UnsupportedOperationException e) {
 }
 try {
  Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode());
  c.getType();
  fail("The code of Maximum can't be handled by Cell.Type");
 } catch(UnsupportedOperationException e) {
 }
}

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

TColumn column = new TColumn(ByteBuffer.wrap(familyEntry.getKey()));
for (Cell cell: familyEntry.getValue()) {
 TDeleteType cellDeleteType = deleteTypeFromHBase(cell.getType());
 if (type == null) {
  type = cellDeleteType;

代码示例来源:origin: com.aliyun.hbase/alihbase-common

@Test
public void testGetType() throws IOException {
 Cell c = Mockito.mock(Cell.class);
 Mockito.when(c.getType()).thenCallRealMethod();
 for (Cell.Type type : Cell.Type.values()) {
  Mockito.when(c.getTypeByte()).thenReturn(type.getCode());
  assertEquals(type, c.getType());
 }
 try {
  Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Maximum.getCode());
  c.getType();
  fail("The code of Maximum can't be handled by Cell.Type");
 } catch(UnsupportedOperationException e) {
 }
 try {
  Mockito.when(c.getTypeByte()).thenReturn(KeyValue.Type.Minimum.getCode());
  c.getType();
  fail("The code of Maximum can't be handled by Cell.Type");
 } catch(UnsupportedOperationException e) {
 }
}

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

columnValue.setFamily(family)
  .setQualifier(CellUtil.cloneQualifier(cell))
  .setType(cell.getType().getCode())
  .setTimestamp(cell.getTimestamp())
  .setValue(CellUtil.cloneValue(cell));

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

columnValue.setFamily(family)
  .setQualifier(CellUtil.cloneQualifier(cell))
  .setType(cell.getType().getCode())
  .setTimestamp(cell.getTimestamp())
  .setValue(CellUtil.cloneValue(cell));

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

@Override
  public Type getType() {
    return cell.getType();
  }
};

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

@Override
public Type getType() {
 return cell.getType();
}

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

col.setTimestamp(kv.getTimestamp());
col.setValue(CellUtil.cloneValue(kv));
col.setType(kv.getType().getCode());
if (kv.getTagsLength() > 0) {
 col.setTags(PrivateCellUtil.cloneTags(kv));

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

@Override
  public Type getType() {
    return delegate.getType();
  }
}

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

private Cell newCellWithNotExistColumnFamily(Cell cell) {
 return ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
   .setRow(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength())
   .setFamily(CF_NOT_EXIST_BYTES, 0, CF_NOT_EXIST_BYTES.length)
   .setQualifier(CellUtil.cloneQualifier(cell)).setTimestamp(cell.getTimestamp())
   .setType(cell.getType().getCode()).setValue(CellUtil.cloneValue(cell)).build();
}

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

private Cell newCellWithDifferentColumnFamily(Cell cell) {
 return ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
   .setRow(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength())
   .setFamily(CF2_BYTES, 0, CF2_BYTES.length).setQualifier(CellUtil.cloneQualifier(cell))
   .setTimestamp(cell.getTimestamp()).setType(cell.getType().getCode())
   .setValue(CellUtil.cloneValue(cell)).build();
}

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

public static void mutatePutValue(Put somePut, byte[] family, byte[] qualifier, byte[] newValue) {
  NavigableMap<byte[], List<Cell>> familyCellMap = somePut.getFamilyCellMap();
  List<Cell> cells = familyCellMap.get(family);
  List<Cell> newCells = Lists.newArrayList();
  if (cells != null) {
    for (Cell cell : cells) {
      if (Bytes.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(),
        qualifier, 0, qualifier.length) == 0) {
        Cell replacementCell = new KeyValue(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),
          cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(), cell.getQualifierArray(),
          cell.getQualifierOffset(), cell.getQualifierLength(), cell.getTimestamp(),
          KeyValue.Type.codeToType(cell.getType().getCode()), newValue, 0, newValue.length);
        newCells.add(replacementCell);
      } else {
        newCells.add(cell);
      }
    }
    familyCellMap.put(family, newCells);
  }
}

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

@Override
  public Type getType() {
    return cell.getType();
  }
};

代码示例来源:origin: org.apache.phoenix/phoenix-core

@Override
  public Type getType() {
    return cell.getType();
  }
};

代码示例来源:origin: com.aliyun.hbase/alihbase-client

@Override
public Type getType() {
 return cell.getType();
}

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

cell.getValueLength())
.setTimestamp(cell.getTimestamp())
.setType(cell.getType())
.setTags(TagUtil.concatTags(tagArray, cell))
.build();

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

VIEW_STATEMENT_BYTES, 0, VIEW_STATEMENT_BYTES.length,
      cell.getTimestamp(), viewStatement, 0, viewStatement.length,
      cell.getType());
cells.add(viewStatementCell);
      cell.getFamilyOffset(), cell.getFamilyLength(),
      VIEW_CONSTANT_BYTES, 0, VIEW_CONSTANT_BYTES.length,
      cell.getTimestamp(), bytes, 0, bytes.length, cell.getType());
cells.add(viewConstantCell);
        cell.getFamilyLength(), VIEW_INDEX_ID_BYTES, 0,
        VIEW_INDEX_ID_BYTES.length, cell.getTimestamp(), bytes, 0,
        bytes.length, cell.getType());
  cells.add(indexIdCell);
  indexId = seqValue;

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

public static void mutatePutValue(Put somePut, byte[] family, byte[] qualifier, byte[] newValue) {
  NavigableMap<byte[], List<Cell>> familyCellMap = somePut.getFamilyCellMap();
  List<Cell> cells = familyCellMap.get(family);
  List<Cell> newCells = Lists.newArrayList();
  if (cells != null) {
    for (Cell cell : cells) {
      if (Bytes.compareTo(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(),
        qualifier, 0, qualifier.length) == 0) {
        Cell replacementCell = new KeyValue(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),
          cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(), cell.getQualifierArray(),
          cell.getQualifierOffset(), cell.getQualifierLength(), cell.getTimestamp(),
          KeyValue.Type.codeToType(cell.getType().getCode()), newValue, 0, newValue.length);
        newCells.add(replacementCell);
      } else {
        newCells.add(cell);
      }
    }
    familyCellMap.put(family, newCells);
  }
}

相关文章