final KijiDataRequest dataRequest = KijiDataRequest.builder()
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.addFamily("info"))
.build();
final KijiRowData row = reader.get(eid, dataRequest);
assertEquals(2, row.getValues("info", "name").size());
assertEquals(2, row.getValues("info", "email").size());
}
// Test FirstKeyOnly filter when applied on the group-type family.
{
final KijiDataRequest dataRequest = KijiDataRequest.builder()
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.withFilter(new KijiFirstKeyOnlyColumnFilter())
.addFamily("info"))
.build();
final KijiRowData row = reader.get(eid, dataRequest);
assertEquals(1, row.getValues("info", "name").size());
assertEquals(1, row.getValues("info", "email").size());
}
// Test FirstKeyOnly filter when applied on a single column.
// Make sure it doesn't affect other columns.
{
final KijiDataRequest dataRequest = KijiDataRequest.builder()
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.withFilter(new KijiFirstKeyOnlyColumnFilter())
.add("info", "name"))
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.add("info", "email"))
.build();
final KijiRowData row = reader.get(eid, dataRequest);
assertEquals(1, row.getValues("info", "name").size());
assertEquals(2, row.getValues("info", "email").size());
}
// Test FirstKeyOnly filter when applied on a single column.
// Make sure it doesn't affect other columns.
{
final KijiDataRequest dataRequest = KijiDataRequest.builder()
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.add("info", "name"))
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.withFilter(new KijiFirstKeyOnlyColumnFilter())
.add("info", "email"))
.build();
final KijiRowData row = reader.get(eid, dataRequest);
assertEquals(2, row.getValues("info", "name").size());
assertEquals(1, row.getValues("info", "email").size());
}
} finally {
reader.close();
}