use of org.apache.fluo.api.data.ColumnValue in project incubator-rya by apache.
the class JoinResultUpdater method fillSiblingBatch.
/**
* Fetches batch to be processed by scanning over the Span specified by the
* {@link JoinBatchInformation}. The number of results is less than or equal
* to the batch size specified by the JoinBatchInformation.
*
* @param tx - Fluo transaction in which batch operation is performed
* @param siblingSpan - span of sibling to retrieve elements to join with
* @param bsSet- set that batch results are added to
* @return Set - containing results of sibling scan.
* @throws Exception
*/
private Optional<RowColumn> fillSiblingBatch(final TransactionBase tx, final Span siblingSpan, final Column siblingColumn, final Set<VisibilityBindingSet> bsSet, final int batchSize) throws Exception {
final RowScanner rs = tx.scanner().over(siblingSpan).fetch(siblingColumn).byRow().build();
final Iterator<ColumnScanner> colScannerIter = rs.iterator();
boolean batchLimitMet = false;
Bytes row = siblingSpan.getStart().getRow();
while (colScannerIter.hasNext() && !batchLimitMet) {
final ColumnScanner colScanner = colScannerIter.next();
row = colScanner.getRow();
final Iterator<ColumnValue> iter = colScanner.iterator();
while (iter.hasNext() && !batchLimitMet) {
bsSet.add(BS_SERDE.deserialize(iter.next().getValue()));
// check if batch size has been met and set flag if it has been met
if (bsSet.size() >= batchSize) {
batchLimitMet = true;
}
}
}
if (batchLimitMet) {
return Optional.of(new RowColumn(row, siblingColumn));
} else {
return Optional.absent();
}
}
Aggregations