Read using a chain filter (HBase)

Creates a composite filter using chaining.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample


To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

public static void filterComposingChain() {
  // TODO(developer): Replace these variables before running the sample.
  String projectId = "my-project-id";
  String instanceId = "my-instance-id";
  String tableId = "mobile-time-series";
  filterComposingChain(projectId, instanceId, tableId);

public static void filterComposingChain(String projectId, String instanceId, String tableId) {
  // A filter that selects one cell per row AND within the column family cell_plan
  Filter familyFilter =
      new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("cell_plan")));
  Filter columnCountGetFilter = new ColumnCountGetFilter(3);

  FilterList filter = new FilterList(FilterList.Operator.MUST_PASS_ALL);
  Scan scan = new Scan().setFilter(filter);
  readWithFilter(projectId, instanceId, tableId, scan);

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.