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


Java CellSetModel.getRows方法代码示例

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


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

示例1: buildResultFromModel

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
protected Result[] buildResultFromModel(final CellSetModel model) {
  List<Result> results = new ArrayList<Result>();
  for (RowModel row: model.getRows()) {
    List<Cell> kvs = new ArrayList<Cell>();
    for (CellModel cell: row.getCells()) {
      byte[][] split = KeyValue.parseColumn(cell.getColumn());
      byte[] column = split[0];
      byte[] qualifier = null;
      if (split.length == 1) {
        qualifier = HConstants.EMPTY_BYTE_ARRAY;
      } else if (split.length == 2) {
        qualifier = split[1];
      } else {
        throw new IllegalArgumentException("Invalid familyAndQualifier provided.");
      }
      kvs.add(new KeyValue(row.getKey(), column, qualifier,
        cell.getTimestamp(), cell.getValue()));
    }
    results.add(Result.create(kvs));
  }
  return results.toArray(new Result[results.size()]);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:RemoteHTable.java

示例2: buildResultFromModel

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
protected Result[] buildResultFromModel(final CellSetModel model) {
  List<Result> results = new ArrayList<>();
  for (RowModel row: model.getRows()) {
    List<Cell> kvs = new ArrayList<>(row.getCells().size());
    for (CellModel cell: row.getCells()) {
      byte[][] split = CellUtil.parseColumn(cell.getColumn());
      byte[] column = split[0];
      byte[] qualifier = null;
      if (split.length == 1) {
        qualifier = HConstants.EMPTY_BYTE_ARRAY;
      } else if (split.length == 2) {
        qualifier = split[1];
      } else {
        throw new IllegalArgumentException("Invalid familyAndQualifier provided.");
      }
      kvs.add(new KeyValue(row.getKey(), column, qualifier,
        cell.getTimestamp(), cell.getValue()));
    }
    results.add(Result.create(kvs));
  }
  return results.toArray(new Result[results.size()]);
}
 
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:RemoteHTable.java

示例3: verifyScan

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private static void verifyScan(Scan s, long expectedRows, long expectedKeys) 
    throws Exception {
  ScannerModel model = ScannerModel.fromScan(s);
  model.setBatch(Integer.MAX_VALUE); // fetch it all at once
  StringWriter writer = new StringWriter();
  marshaller.marshal(model, writer);
  LOG.debug(writer.toString());
  byte[] body = Bytes.toBytes(writer.toString());
  Response response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_XML, body);
  assertEquals(response.getCode(), 201);
  String scannerURI = response.getLocation();
  assertNotNull(scannerURI);

  // get a cell set
  response = client.get(scannerURI, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  CellSetModel cells = (CellSetModel)
    unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));

  int rows = cells.getRows().size();
  assertTrue("Scanned too many rows! Only expected " + expectedRows + 
      " total but scanned " + rows, expectedRows == rows);
  for (RowModel row: cells.getRows()) {
    int count = row.getCells().size();
    assertEquals("Expected " + expectedKeys + " keys per row but " +
      "returned " + count, expectedKeys, count);
  }

  // delete the scanner
  response = client.delete(scannerURI);
  assertEquals(response.getCode(), 200);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:TestScannersWithFilters.java

示例4: buildResultFromModel

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
protected Result[] buildResultFromModel(final CellSetModel model) {
  List<Result> results = new ArrayList<Result>();
  for (RowModel row: model.getRows()) {
    List<KeyValue> kvs = new ArrayList<KeyValue>();
    for (CellModel cell: row.getCells()) {
      byte[][] split = KeyValue.parseColumn(cell.getColumn());
      byte[] column = split[0];
      byte[] qualifier = split.length > 1 ? split[1] : null;
      kvs.add(new KeyValue(row.getKey(), column, qualifier, 
        cell.getTimestamp(), cell.getValue()));
    }
    results.add(new Result(kvs));
  }
  return results.toArray(new Result[results.size()]);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:16,代码来源:RemoteHTable.java

示例5: verifyScan

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private static void verifyScan(Scan s, long expectedRows, long expectedKeys) 
    throws Exception {
  ScannerModel model = ScannerModel.fromScan(s);
  model.setBatch(Integer.MAX_VALUE); // fetch it all at once
  StringWriter writer = new StringWriter();
  marshaller.marshal(model, writer);
  LOG.debug(writer.toString());
  byte[] body = Bytes.toBytes(writer.toString());
  Response response = client.put("/" + TABLE + "/scanner", 
    Constants.MIMETYPE_XML, body);
  assertEquals(response.getCode(), 201);
  String scannerURI = response.getLocation();
  assertNotNull(scannerURI);

  // get a cell set
  response = client.get(scannerURI, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  CellSetModel cells = (CellSetModel)
    unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));

  int rows = cells.getRows().size();
  assertTrue("Scanned too many rows! Only expected " + expectedRows + 
      " total but scanned " + rows, expectedRows == rows);
  for (RowModel row: cells.getRows()) {
    int count = row.getCells().size();
    assertEquals("Expected " + expectedKeys + " keys per row but " +
      "returned " + count, expectedKeys, count);
  }

  // delete the scanner
  response = client.delete(scannerURI);
  assertEquals(response.getCode(), 200);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:35,代码来源:TestScannersWithFilters.java

示例6: verifyScan

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private static void verifyScan(Scan s, long expectedRows, long expectedKeys)
    throws Exception {
  ScannerModel model = ScannerModel.fromScan(s);
  model.setBatch(Integer.MAX_VALUE); // fetch it all at once
  StringWriter writer = new StringWriter();
  marshaller.marshal(model, writer);
  LOG.debug(writer.toString());
  byte[] body = Bytes.toBytes(writer.toString());
  Response response = client.put("/" + TABLE + "/scanner",
    Constants.MIMETYPE_XML, body);
  assertEquals(201, response.getCode());
  String scannerURI = response.getLocation();
  assertNotNull(scannerURI);

  // get a cell set
  response = client.get(scannerURI, Constants.MIMETYPE_XML);
  assertEquals(200, response.getCode());
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  CellSetModel cells = (CellSetModel)
    unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));

  int rows = cells.getRows().size();
  assertTrue("Scanned too many rows! Only expected " + expectedRows +
      " total but scanned " + rows, expectedRows == rows);
  for (RowModel row: cells.getRows()) {
    int count = row.getCells().size();
    assertEquals("Expected " + expectedKeys + " keys per row but " +
      "returned " + count, expectedKeys, count);
  }

  // delete the scanner
  response = client.delete(scannerURI);
  assertEquals(200, response.getCode());
}
 
开发者ID:apache,项目名称:hbase,代码行数:35,代码来源:TestScannersWithFilters.java

示例7: checkRowsNotNull

import org.apache.hadoop.hbase.rest.model.CellSetModel; //导入方法依赖的package包/类
private void checkRowsNotNull(CellSetModel model) {
  for (RowModel row: model.getRows()) {
    assertTrue(row.getKey() != null);
    assertTrue(row.getCells().size() > 0);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestTableScan.java


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