.withValue("value1")
.build();
final KijiTable table = kiji.openTable("row_data_test_table");
try {
final KijiTableReader reader = table.openTableReader();
try {
final KijiDataRequest dataRequest = KijiDataRequest.builder()
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.add("family", "qual0"))
.addColumns(ColumnsDef.create()
.withMaxVersions(HConstants.ALL_VERSIONS)
.withPageSize(1)
.addFamily("map"))
.build();
final KijiRowScanner scanner = reader.getScanner(dataRequest);
try {
int nrows = 0;
boolean foundRow0 = false;
for (KijiRowData row : scanner) {
LOG.debug("Scanning row: {}", row);
// All rows but "row3" should be scanned through:
assertFalse(row.getEntityId().getComponentByIndex(0).equals("row3"));
// Validate "row0", which contains both paged and non-paged cells:
if (row.getEntityId().getComponentByIndex(0).equals("row0")) {
foundRow0 = true;
// Make sure we can still read the columns that are not paged:
assertEquals(ImmutableMap.builder()
.put(3L, new Utf8("value3"))
.put(2L, new Utf8("value2"))
.put(1L, new Utf8("value1"))
.build(),
row.getValues("family", "qual0"));
// The values for "map:*" should ideally not be retrieved.
// We cannot use KeyOnlyFilter, but we can use FirstKeyOnlyFilter to limit
// the number of KeyValues fetched:
assertEquals(ImmutableMap.builder()
.put("int1", ImmutableMap.builder()
.put(1L, 11)
.build())
.build(),
row.getValues("map"));
}
nrows += 1;
}
assertEquals(3, nrows);
assertTrue(foundRow0);
} finally {
scanner.close();
}
} finally {
reader.close();
}
} finally {
table.release();
}
}