org.apache.hadoop.hbase.filter.ColumnPaginationFilter Java Examples

The following examples show how to use org.apache.hadoop.hbase.filter.ColumnPaginationFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HBaseManager.java    From hbase-secondary-index with GNU General Public License v3.0 6 votes vote down vote up
public void testGet() throws IOException {
	long st = System.currentTimeMillis();
	Get get = new Get(
			Bytes.toBytes("{1F591795-74DE-EB70-0245-0E4465C72CFA}"));
	get.addColumn(Bytes.toBytes("bhvr"), Bytes.toBytes("vvmid"));
	get.setMaxVersions(100);
	// get.setTimeRange(1354010844711L - 12000L, 1354010844711L);

	// get.setTimeStamp(1354700700000L);

	Filter filter = new ColumnPaginationFilter(1, 10);
	get.setFilter(filter);

	Result dbResult = table.get(get);

	System.out.println("result=" + dbResult.toString());

	long en2 = System.currentTimeMillis();
	System.out.println("Total Time: " + (en2 - st) + " ms");

}
 
Example #2
Source File: Filters.java    From java-docs-samples with Apache License 2.0 5 votes vote down vote up
public static void filterLimitCellsPerRow(String projectId, String instanceId, String tableId) {
  // A filter that matches the first 2 cells of each row
  //    Filter filter = new ColumnCountGetFilter(2);
  Filter filter = new ColumnPaginationFilter(2, 0);

  Scan scan = new Scan().setFilter(filter);
  readWithFilter(projectId, instanceId, tableId, scan);
}
 
Example #3
Source File: Filters.java    From java-docs-samples with Apache License 2.0 5 votes vote down vote up
public static void filterLimitCellsPerRowOffset(
    String projectId, String instanceId, String tableId) {
  // A filter that skips the first 2 cells per row
  Filter filter = new ColumnPaginationFilter(Integer.MAX_VALUE, 2);
  Scan scan = new Scan().setFilter(filter);
  readWithFilter(projectId, instanceId, tableId, scan);
}
 
Example #4
Source File: HBaseManager.java    From hbase-secondary-index with GNU General Public License v3.0 5 votes vote down vote up
public void testScanGet() throws IOException {
	long st = System.currentTimeMillis();

	Get get = new Get(
			Bytes.toBytes("{1F591795-74DE-EB70-0245-0E4465C72CFA}"));
	get.addColumn(Bytes.toBytes("bhvr"), Bytes.toBytes("vvmid"));

	Filter filter = new ColumnPaginationFilter(1, 10);

	Scan scanner = new Scan(get);
	scanner.setFilter(filter);
	scanner.setMaxVersions(100);
	// scanner.setCaching(100);
	// scanner.setBatch(10);

	ResultScanner rsScanner = table.getScanner(scanner);

	for (Result result : rsScanner) {
		System.out.println(result);
	}
	rsScanner.close();

	int version = 0;
	// int count = 0;
	// for (Result res : rsScanner) {
	// System.out.println("count: " + ++count);
	// final List<KeyValue> list = res.list();
	//
	// for (final KeyValue kv : list)
	// System.out.println(kv.toString());
	//
	// version = list.size();
	// }
	// rsScanner.close();

	long en2 = System.currentTimeMillis();
	System.out.println("Total rows: " + version);
	System.out.println("Total Time: " + (en2 - st) + " ms");

}