@Override
public ResultIterator iterator() throws SQLException {
ImmutableBytesPtr[] joinIds = joinInfo.getJoinIds();
assert (joinIds.length == hashExpressions.length && joinIds.length == hashPlans.length);
final HashCacheClient hashClient = new HashCacheClient(plan.getContext().getConnection());
Scan scan = plan.getContext().getScan();
final ScanRanges ranges = plan.getContext().getScanRanges();
int count = joinIds.length;
ConnectionQueryServices services = getContext().getConnection().getQueryServices();
ExecutorService executor = services.getExecutor();
List<Future<ServerCache>> futures = new ArrayList<Future<ServerCache>>(count);
List<SQLCloseable> dependencies = new ArrayList<SQLCloseable>(count);
for (int i = 0; i < count; i++) {
final int index = i;
futures.add(executor.submit(new JobCallable<ServerCache>() {
@Override
public ServerCache call() throws Exception {
QueryPlan hashPlan = hashPlans[index];
return hashClient.addHashCache(ranges, hashPlan.iterator(),
hashPlan.getEstimatedSize(), hashExpressions[index], plan.getTableRef());
}
@Override
public Object getJobId() {