scan.addColumn(TypeCf.DATA.bytes, TypeColumn.RECORDTYPE_NAME.bytes);
scan.addColumn(TypeCf.DATA.bytes, TypeColumn.VERSION.bytes);
scan.addFamily(TypeCf.FIELDTYPE_ENTRY.bytes);
scan.addFamily(TypeCf.SUPERTYPE.bytes);
TypeBucket typeBucket = new TypeBucket(bucketId);
ResultScanner scanner = null;
byte[] rowPrefix = AbstractSchemaCache.decodeHexAndNextHex(bucketId);
scan.setStartRow(new byte[]{rowPrefix[0]});
if (!bucketId.equals("ff")) // In case of ff, just scan until
// the end
{
scan.setStopRow(new byte[]{rowPrefix[1]});
}
try {
scanner = getTypeTable().getScanner(scan);
} catch (IOException e) {
throw new TypeException("Exception occurred while retrieving field types and record types without cache ",
e);
}
// Collect the results first and close the scanner as fast as possible
List<Result> results = new ArrayList<Result>();
for (Result scanResult : scanner) {
// Skip empty results from the scanner
if (scanResult != null && !scanResult.isEmpty()) {
results.add(scanResult);
}
}
Closer.close(scanner);
// Now extract the record and field types from the results
for (Result scanResult : results) {
if (scanResult.getValue(TypeCf.DATA.bytes, TypeColumn.FIELDTYPE_NAME.bytes) != null) {
typeBucket.add(extractFieldType(new SchemaIdImpl(scanResult.getRow()), scanResult));
} else if (scanResult.getValue(TypeCf.DATA.bytes, TypeColumn.RECORDTYPE_NAME.bytes) != null) {
typeBucket.addAll(extractRecordType(new SchemaIdImpl(scanResult.getRow()), null, scanResult));
}
}
return typeBucket;
}