use of com.google.cloud.bigtable.hbase.adapters.read.ReadHooks in project java-bigtable-hbase by googleapis.
the class HBaseRequestAdapter method adapt.
/**
* adapt.
*
* @param scan a {@link Scan} object.
* @return a {@link Query} object.
*/
public Query adapt(Scan scan) {
ReadHooks readHooks = new DefaultReadHooks();
Query query = Query.create(getTableId());
Adapters.SCAN_ADAPTER.adapt(scan, readHooks, query);
readHooks.applyPreSendHook(query);
return query;
}
use of com.google.cloud.bigtable.hbase.adapters.read.ReadHooks in project java-bigtable-hbase by googleapis.
the class HBaseRequestAdapter method adapt.
/**
* adapt.
*
* @param get a {@link Get} object.
* @return a {@link Query} object.
*/
public Query adapt(Get get) {
ReadHooks readHooks = new DefaultReadHooks();
Query query = Query.create(getTableId());
Adapters.GET_ADAPTER.adapt(get, readHooks, query);
readHooks.applyPreSendHook(query);
return query;
}
use of com.google.cloud.bigtable.hbase.adapters.read.ReadHooks in project java-bigtable-hbase by googleapis.
the class TestPageFilterAdapter method pageFilterIsAppliedToReadRowsRequest.
@Test
public void pageFilterIsAppliedToReadRowsRequest() throws IOException {
final String TABLE_ID = "tableId";
final RequestContext requestContext = RequestContext.create("ProjectId", "InstanceId", "AppProfile");
ReadHooks hooks = new DefaultReadHooks();
FilterAdapterContext context = new FilterAdapterContext(new Scan(), hooks);
PageFilter pageFilter = new PageFilter(20);
Filters.Filter adaptedFilter = pageFilterAdapter.adapt(context, pageFilter);
Assert.assertNull("PageFilterAdapter should not return a Filters.Filter.", adaptedFilter);
Query query = Query.create(TABLE_ID).limit(100);
hooks.applyPreSendHook(query);
Assert.assertEquals(20, query.toProto(requestContext).getRowsLimit());
}
Aggregations