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

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

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

Cell.getRow介绍

[英]WARNING do not use, expensive. this gets an arraycopy of the cell's row. Added to ease transition from 0.94 -> 0.96.
[中]警告不要使用,价格昂贵。这将获取单元格行的阵列副本。添加以简化从0.94->0.96的转换。

代码示例

代码示例来源:origin: harbby/presto-connectors

@Override
@Deprecated
public byte[] getRow() {
 return cell.getRow();
}

代码示例来源:origin: stackoverflow.com

public CellRangeAddress getMergedRegionForCell(Cell c) {
  Sheet s = c.getRow().getSheet();
  for (CellRangeAddress mergedRegion : s.getMergedRegions()) {
   if (mergedRegion.isInRange(c.getRowIndex(), c.getColumnIndex())) {
     // This region contains the cell in question
     return mergedRegion;
   }
  }
  // Not in any
  return null;
}

代码示例来源:origin: stackoverflow.com

/**
 * unmove (move back) in maze
 */
void unmove(Cell badCell) {

  // set cell leaving as bad path
  matrix[badCell.getRow()][badCell.getCol()].setIsBadPath(true);
  matrix[badCell.getRow()][badCell.getCol()].setIsVisited(false);

  // remove cell leaving from stack (solution path)
  path.pop();
}

代码示例来源:origin: stackoverflow.com

/**
 * move (forward) in maze
 */
void move(Cell goodCell) {

  // set cell moving to as visited
  matrix[goodCell.getRow()][goodCell.getCol()].setIsVisited(true);

  // update current location in maze to cell moving
  setCurrent(goodCell);

  // store cell moved to in stack (solution path)
  path.push(goodCell);
}

代码示例来源:origin: stackoverflow.com

private int maxSequence (char player, Cell c)
{
  int row = c.getRow();
  int col = c.getCol();
  int maxVert = 0;
  int maxHor = 0;
  int maxDiag = 0;

  for (int j = 0; j < _board[0].length; j++)
  {
    if ((board [col]  [row+j] == player) || (board [col]  [row-j] == player))  maxVert++;
    if ((board [col+j][row]   == player) || (board [col-j][row]   == player))  maxHor++;
    if ((board [col+j][row+j] == player) || (board [col-j][row-j] == player))  maxDiag++;
  }
  return Math.max (maxHor, Math.max (maxVert, maxDiag));
}

代码示例来源:origin: stackoverflow.com

public String getData(String SheetName, String DataSet, String ColumnName) throws JXLException, IOException {
  Workbook workbook = Workbook.getWorkbook(new File( ".\\data\\TestData.xls"));
  Sheet sheet = workbook.getSheet(SheetName);
  Cell sTestData = sheet.findCell(DataSet);
  int iNumCol = sheet.getColumns();
  int iRow = sTestData.getRow();
  boolean bColumnFound = false;
  int iCol;

  for (int p = 0; p < iNumCol; p++) {
    String sCol = sheet.getCell(p, 0).getContents();
    if (sCol.matches(ColumnName)) {
      iCol = p;
      bColumnFound = true;
    }

  }
  if (!bColumnFound) {
    return "";
  }
  return sheet.getCell(iCol, iRow).getContents();
}

代码示例来源:origin: stackoverflow.com

/**
 * is valid move
 */
bool isValidMove(Cell toCell) {

  int row = toCell.getRow();
  int col = toCell.getCol();

  // check if within bounds of maze
  if ((row >= 0 && row < rows) && (col >= 0 && col < cols)) {

    // if not a wall
    if (!matrix[row][col].getIsWall()) {

      // if not a bad path
      if (!matrix[row][col].getIsBadPath()) {
        return true;
      }
    }
  }
  return false;
}

代码示例来源:origin: stackoverflow.com

for (Row r : sheet) {
  for (Cell c : r) {
    int columnNumber = c.getColumnIndex();
    int rowNumber = c.getRow().getRowNum();
    CellReference cr = new CellReference(c);
    System.out.println("Cell at " + rowNum + "," + columnNumber + " found, that's " + cr.formatAsString());
  }
}

代码示例来源:origin: stackoverflow.com

private int maxSequence (char player , Cell c)
{
  int row = c.getRow();
  int col = c.getCol();
  int maxVert = 0;
  int maxHor = 0;
  int maxDiag = 0;

  for (int j = 0; j < _board[0].length; j++)
  {
    if ( (_board[col][row+j] == O) || (_board[col][row-j] == player) )
    {
      maxVert++;
    }

    if ( (_board[col+j][row] == O) || (_board[col-j][row] == player) )
    {
      maxHor++;
    }

    if ( (_board[col+j][row+j] == 0) || (_board[col-j][row-j] == player) )
    {
      maxDiag++;
    }
  }

  return Math.max(maxDiag, Math.max(maxVert, maxHor));
}

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

@Override
public int compare(byte[] left, int loffset, int llength, byte[] right, int roffset, int rlength) {
 // BytesWritable and KeyValue each serialize 4 bytes to indicate length
 if (llength < 8) {
  throw new AssertionError("Too small llength: " + llength);
 }
 if (rlength < 8) {
  throw new AssertionError("Too small rlength: " + rlength);
 }
 Cell leftKey = new KeyValue(left, loffset + 8, llength - 8);
 Cell rightKey = new KeyValue(right, roffset + 8, rlength - 8);
 byte[] lRow = leftKey.getRow();
 byte[] rRow = rightKey.getRow();
 int rowCmp = Bytes.compareTo(lRow, rRow);
 if (rowCmp != 0) {
  return rowCmp;
 } else {
  return KeyValue.COMPARATOR.compare(leftKey, rightKey);
 }
}

代码示例来源:origin: stackoverflow.com

service.getFeed(cellFeedUrl, CellFeed.class);
for(CellEntry ce : cellFeed.getEntries()) {
 Cell cell = ce.getCell();
 if(cell.getRow() == 1 && cell.getCol() == 3) {
  System.out.println(cell.getDoubleValue());
 }
}

代码示例来源:origin: harbby/presto-connectors

private void collectRow() {
 rowSizeBytes.update(curRowBytes);
 rowSizeCols.update(curRowCols);
 keyLen.update(curRowKeyLength);
 if (curRowBytes > maxRowBytes && prevCell != null) {
  biggestRow = prevCell.getRow();
  maxRowBytes = curRowBytes;
 }
 curRowBytes = 0;
 curRowCols = 0;
}

代码示例来源:origin: harbby/presto-connectors

@Override
public void append(RegionEntryBuffer buffer) throws IOException {
 List<Entry> entries = buffer.getEntryBuffer();
 if (entries.isEmpty() || entries.get(0).getEdit().getCells().isEmpty()) {
  return;
 }
 // meta edits (e.g. flush) are always replicated.
 // data edits (e.g. put) are replicated if the table requires them.
 if (!requiresReplication(buffer.getTableName(), entries)) {
  return;
 }
 sinkWriter.append(buffer.getTableName(), buffer.getEncodedRegionName(),
  entries.get(0).getEdit().getCells().get(0).getRow(), entries);
}

代码示例来源:origin: cdapio/cdap

@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
 Result res = table.get(new Get(row));
 Cell resA = res.getColumnLatestCell(FAMILY, col);
 assertFalse(res.isEmpty());
 assertNotNull(resA);
 assertEquals(expected, Bytes.toLong(resA.getValue()));
 Scan scan = new Scan(row);
 scan.addFamily(FAMILY);
 ResultScanner scanner = table.getScanner(scan);
 Result scanRes = scanner.next();
 assertNotNull(scanRes);
 assertFalse(scanRes.isEmpty());
 Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
 assertArrayEquals(row, scanResA.getRow());
 assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}

代码示例来源:origin: cdapio/cdap

@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
 Result res = table.get(new Get(row));
 Cell resA = res.getColumnLatestCell(FAMILY, col);
 assertFalse(res.isEmpty());
 assertNotNull(resA);
 assertEquals(expected, Bytes.toLong(resA.getValue()));
 Scan scan = new Scan(row);
 scan.addFamily(FAMILY);
 ResultScanner scanner = table.getScanner(scan);
 Result scanRes = scanner.next();
 assertNotNull(scanRes);
 assertFalse(scanRes.isEmpty());
 Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
 assertArrayEquals(row, scanResA.getRow());
 assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}

代码示例来源:origin: cdapio/cdap

@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
 Result res = table.get(new Get(row));
 Cell resA = res.getColumnLatestCell(FAMILY, col);
 assertFalse(res.isEmpty());
 assertNotNull(resA);
 assertEquals(expected, Bytes.toLong(resA.getValue()));
 Scan scan = new Scan(row);
 scan.addFamily(FAMILY);
 ResultScanner scanner = table.getScanner(scan);
 Result scanRes = scanner.next();
 assertNotNull(scanRes);
 assertFalse(scanRes.isEmpty());
 Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
 assertArrayEquals(row, scanResA.getRow());
 assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}

代码示例来源:origin: caskdata/cdap

@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
 Result res = table.get(new Get(row));
 Cell resA = res.getColumnLatestCell(FAMILY, col);
 assertFalse(res.isEmpty());
 assertNotNull(resA);
 assertEquals(expected, Bytes.toLong(resA.getValue()));
 Scan scan = new Scan(row);
 scan.addFamily(FAMILY);
 ResultScanner scanner = table.getScanner(scan);
 Result scanRes = scanner.next();
 assertNotNull(scanRes);
 assertFalse(scanRes.isEmpty());
 Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
 assertArrayEquals(row, scanResA.getRow());
 assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}

代码示例来源:origin: cdapio/cdap

@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
 Result res = table.get(new Get(row));
 Cell resA = res.getColumnLatestCell(FAMILY, col);
 assertFalse(res.isEmpty());
 assertNotNull(resA);
 assertEquals(expected, Bytes.toLong(resA.getValue()));
 Scan scan = new Scan(row);
 scan.addFamily(FAMILY);
 ResultScanner scanner = table.getScanner(scan);
 Result scanRes = scanner.next();
 assertNotNull(scanRes);
 assertFalse(scanRes.isEmpty());
 Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
 assertArrayEquals(row, scanResA.getRow());
 assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}

代码示例来源:origin: cdapio/cdap

@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
 Result res = table.get(new Get(row));
 Cell resA = res.getColumnLatestCell(FAMILY, col);
 assertFalse(res.isEmpty());
 assertNotNull(resA);
 assertEquals(expected, Bytes.toLong(resA.getValue()));
 Scan scan = new Scan(row);
 scan.addFamily(FAMILY);
 ResultScanner scanner = table.getScanner(scan);
 Result scanRes = scanner.next();
 assertNotNull(scanRes);
 assertFalse(scanRes.isEmpty());
 Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
 assertArrayEquals(row, scanResA.getRow());
 assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}

代码示例来源:origin: cdapio/cdap

@Override
public void assertColumn(HTable table, byte[] row, byte[] col, long expected) throws Exception {
 Result res = table.get(new Get(row));
 Cell resA = res.getColumnLatestCell(FAMILY, col);
 assertFalse(res.isEmpty());
 assertNotNull(resA);
 assertEquals(expected, Bytes.toLong(resA.getValue()));
 Scan scan = new Scan(row);
 scan.addFamily(FAMILY);
 ResultScanner scanner = table.getScanner(scan);
 Result scanRes = scanner.next();
 assertNotNull(scanRes);
 assertFalse(scanRes.isEmpty());
 Cell scanResA = scanRes.getColumnLatestCell(FAMILY, col);
 assertArrayEquals(row, scanResA.getRow());
 assertEquals(expected, Bytes.toLong(scanResA.getValue()));
}

相关文章