Program: 112937
Project: 112937
Buggy source:
protected Iterator<Map<String,AttributeValue>> getResults(final double[] maxResolutionSubsamplingPerDimension,final Integer limit,final AdapterStore adapterStore){
  final List<ByteArrayRange> ranges=getRanges();
  final String tableName=dynamodbOperations.getQualifiedTableName(StringUtils.stringFromBinary(index.getId().getBytes()));
  if ((ranges != null) && !ranges.isEmpty()) {
    final List<QueryRequest> requests=new ArrayList<>();
    if (ranges.size() == 1 && (adapterIds.size() == 1)) {
      final List<QueryRequest> queries=getPartitionRequests(tableName);
      final ByteArrayRange r=ranges.get(0);
      if (r.isSingleValue()) {
        for (        final QueryRequest query : queries) {
          for (          final ByteArrayId adapterID : adapterIds) {
            byte[] start=ByteArrayUtils.combineArrays(adapterID.getBytes(),r.getStart().getBytes());
            query.addQueryFilterEntry(DynamoDBRow.GW_RANGE_KEY,new Condition().withAttributeValueList(new AttributeValue().withB(ByteBuffer.wrap(start))).withComparisonOperator(ComparisonOperator.EQ));
          }
        }
      }
 else {
        for (        final QueryRequest query : queries) {
          for (          final ByteArrayId adapterID : adapterIds) {
            addQueryRange(r,query,adapterID);
          }
        }
      }
      requests.addAll(queries);
    }
 else {
      ranges.forEach((r -> requests.addAll(addQueryRanges(tableName,r,adapterIds,(DynamoDBAdapterStore)adapterStore))));
    }
    return Iterators.concat(requests.parallelStream().map(this::executeQueryRequest).iterator());
  }
  final ScanRequest request=new ScanRequest(tableName);
  final ScanResult scanResult=dynamodbOperations.getClient().scan(request);
  return new LazyPaginatedScan(scanResult,request,dynamodbOperations.getClient());
}

Fixed version (ground truth):
protected Iterator<Map<String,AttributeValue>> getResults(final double[] maxResolutionSubsamplingPerDimension,final Integer limit,final AdapterStore adapterStore){
  final List<ByteArrayRange> ranges=getRanges();
  final String tableName=dynamodbOperations.getQualifiedTableName(StringUtils.stringFromBinary(index.getId().getBytes()));
  if ((ranges != null) && !ranges.isEmpty()) {
    final List<QueryRequest> requests=new ArrayList<>();
    if ((ranges.size() == 1) && (adapterIds.size() == 1)) {
      final List<QueryRequest> queries=getPartitionRequests(tableName);
      final ByteArrayRange r=ranges.get(0);
      if (r.isSingleValue()) {
        for (        final QueryRequest query : queries) {
          for (          final ByteArrayId adapterID : adapterIds) {
            final byte[] start=ByteArrayUtils.combineArrays(adapterID.getBytes(),r.getStart().getBytes());
            query.addQueryFilterEntry(DynamoDBRow.GW_RANGE_KEY,new Condition().withAttributeValueList(new AttributeValue().withB(ByteBuffer.wrap(start))).withComparisonOperator(ComparisonOperator.EQ));
          }
        }
      }
 else {
        for (        final QueryRequest query : queries) {
          for (          final ByteArrayId adapterID : adapterIds) {
            addQueryRange(r,query,adapterID);
          }
        }
      }
      requests.addAll(queries);
    }
 else {
      ranges.forEach((r -> requests.addAll(addQueryRanges(tableName,r,adapterIds,adapterStore))));
    }
    return Iterators.concat(requests.parallelStream().map(this::executeQueryRequest).iterator());
  }
 else   if ((adapterIds != null) && !adapterIds.isEmpty()) {
    final List<QueryRequest> queries=getAdapterOnlyQueryRequests(tableName);
    return Iterators.concat(queries.parallelStream().map(this::executeQueryRequest).iterator());
  }
  final ScanRequest request=new ScanRequest(tableName);
  final ScanResult scanResult=dynamodbOperations.getClient().scan(request);
  return new LazyPaginatedScan(scanResult,request,dynamodbOperations.getClient());
}