use of com.google.cloud.bigtable.data.v2.models.Filters.ChainFilter in project java-bigtable-hbase by googleapis.
the class ColumnPaginationFilterAdapter method createChain.
/**
* Create a filter chain that allows the latest values for each qualifier, those cells that pass
* an option intermediate filter and are less than the limit per row.
*/
private Filter createChain(ColumnPaginationFilter filter, Filter intermediate) {
ChainFilter chain = FILTERS.chain();
chain.filter(FILTERS.limit().cellsPerColumn(1));
if (intermediate != null) {
chain.filter(intermediate);
}
chain.filter(FILTERS.limit().cellsPerRow(filter.getLimit()));
return chain;
}
use of com.google.cloud.bigtable.data.v2.models.Filters.ChainFilter in project java-bigtable-hbase by googleapis.
the class ScanAdapter method buildFilter.
/**
* Given a {@link Scan}, build a {@link Filters.Filter} that include matching columns
*
* @param scan a {@link Scan} object.
* @param hooks a {@link ReadHooks} object.
* @return a {@link Filters.Filter} object.
*/
public Filters.Filter buildFilter(Scan scan, ReadHooks hooks) {
ChainFilter chain = FILTERS.chain();
Optional<Filters.Filter> familyFilter = createColumnFamilyFilter(scan);
if (familyFilter.isPresent()) {
chain.filter(familyFilter.get());
}
if (scan.getTimeRange() != null && !scan.getTimeRange().isAllTime()) {
chain.filter(createTimeRangeFilter(scan.getTimeRange()));
}
if (scan.getMaxVersions() != Integer.MAX_VALUE) {
chain.filter(createColumnLimitFilter(scan.getMaxVersions()));
}
Optional<Filters.Filter> userFilter = createUserFilter(scan, hooks);
if (userFilter.isPresent()) {
chain.filter(userFilter.get());
}
Optional<Filters.Filter> colFamilyTimeFilter = createColFamilyTimeRange(scan);
if (colFamilyTimeFilter.isPresent()) {
chain.filter(colFamilyTimeFilter.get());
}
return chain;
}
use of com.google.cloud.bigtable.data.v2.models.Filters.ChainFilter in project java-bigtable-hbase by googleapis.
the class SingleColumnValueFilterAdapter method getColumnSpecFilter.
@VisibleForTesting
static ChainFilter getColumnSpecFilter(byte[] family, byte[] qualifier, boolean latestVersionOnly) throws IOException {
ByteString wrappedQual = quoteRegularExpression(qualifier);
String wrappedFamily = quoteRegularExpression(family).toStringUtf8();
ChainFilter builder = FILTERS.chain().filter(FILTERS.family().regex(wrappedFamily)).filter(FILTERS.qualifier().regex(wrappedQual));
if (latestVersionOnly) {
builder.filter(LATEST_ONLY_FILTER);
}
return builder;
}
Aggregations