builder.newColumnsDef().withMaxVersions(2).addFamily("purchases");
builder.withTimeRange(1L, 3L);
KijiDataRequest request = builder.build();
Scan expectedScan = new Scan();
HBaseColumnName hbaseColumn = mColumnNameTranslator.toHBaseColumnName(
KijiColumnName.create("info:name"));
expectedScan.addColumn(hbaseColumn.getFamily(), hbaseColumn.getQualifier());
HBaseColumnName hPurchasesColumn = mColumnNameTranslator.toHBaseColumnName(
KijiColumnName.create("purchases"));
expectedScan.addFamily(hPurchasesColumn.getFamily());
FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE);
// The Scan object created by HBaseDataRequestAdapter has a filter attached
// to it which corresponds to the set of filters associated with each input
// column (either explicitly, or implicitly by the logic of HBaseDataRequestAdapter):
//
// Each column (e.g., info:name) has a top-level AND(...) filter containing:
// * A FamilyFilter that refers to the translated HBase family (loc group) name for the column
// * A QualifierFilter that refers to the translated qualifier name
// * If maxVersions is 1 for the column, a ColumnPaginationFilter(1, 0) to enforce that.
//
// Each column family has a top-level AND(...) filter containing:
// * A FamilyFilter as above
// * A ColumnPrefixFilter to filter/include only the map-type family within the locality group
//
// These are joined together with a request-level OR(...) filter; so in effect every
// cell included must pass all the filters associated with one of the columns requested.
FilterList infoNameFilter = new FilterList(FilterList.Operator.MUST_PASS_ALL);
Filter infoLgFilter = SchemaPlatformBridge.get().createFamilyFilter(
CompareFilter.CompareOp.EQUAL,
hbaseColumn.getFamily());
infoNameFilter.addFilter(infoLgFilter);
Filter infoNameQualifierFilter = SchemaPlatformBridge.get().createQualifierFilter(
CompareFilter.CompareOp.EQUAL,
hbaseColumn.getQualifier());
infoNameFilter.addFilter(infoNameQualifierFilter);
infoNameFilter.addFilter(new ColumnPaginationFilter(1, 0));
FilterList purchasesFilter = new FilterList(FilterList.Operator.MUST_PASS_ALL);
Filter familyFilter = SchemaPlatformBridge.get().createFamilyFilter(
CompareFilter.CompareOp.EQUAL,
hPurchasesColumn.getFamily());
Filter mapPrefixFilter = new ColumnPrefixFilter(hPurchasesColumn.getQualifier());
purchasesFilter.addFilter(familyFilter);
purchasesFilter.addFilter(mapPrefixFilter);
filterList.addFilter(infoNameFilter);
filterList.addFilter(purchasesFilter);