// Test ALL filter
RecordScan scan = new RecordScan();
scan.setRecordFilter(new RecordTypeFilter(rt.getName()));
scan.setReturnFields(new ReturnFields(ReturnFields.Type.ALL));
Record record = repository.getScanner(scan).next();
assertEquals(3, record.getFields().size());
// Test NONE filter
scan = new RecordScan();
scan.setRecordFilter(new RecordTypeFilter(rt.getName()));
scan.setReturnFields(new ReturnFields(ReturnFields.Type.NONE));
record = repository.getScanner(scan).next();
assertEquals(0, record.getFields().size());
// Test ENUM filter
scan = new RecordScan();
scan.setRecordFilter(new RecordTypeFilter(rt.getName()));
scan.setReturnFields(new ReturnFields(f1.getName(), f2.getName()));
record = repository.getScanner(scan).next();
assertEquals(2, record.getFields().size());
assertTrue(record.hasField(f1.getName()));
assertTrue(record.hasField(f2.getName()));
assertFalse(record.hasField(f3.getName()));
// Test scanning on filtered field, should not work
scan = new RecordScan();
RecordFilterList filterList = new RecordFilterList();
filterList.addFilter(new RecordTypeFilter(rt.getName()));
filterList.addFilter(new FieldValueFilter(f1.getName(), "A"));
scan.setRecordFilter(filterList);
// without ReturnFields, we get a result
assertNotNull(repository.getScanner(scan).next());
// with ReturnFields that doesn't include f1, we don't get a result
scan.setReturnFields(new ReturnFields(f2.getName()));
// TODO disabled this test as it was sometimes failing, and sometimes not
// In the cases where it failed, it did bring up the row which is
// correct according to the filters, but which we didn't expect to
// receive because a filter was applied on a non-read column.
// The conclusion could be that while HBase can't guarantee the filter