Program: 113070
Project: 113070
Buggy source:
protected ScannerBase getScanner(final AccumuloOperations accumuloOperations,final double[] maxResolutionSubsamplingPerDimension,final Integer limit){
  final List<ByteArrayRange> ranges=getRanges();
  final String tableName=StringUtils.stringFromBinary(index.getId().getBytes());
  ScannerBase scanner;
  try {
    if ((ranges != null) && (ranges.size() == 1)) {
      scanner=accumuloOperations.createScanner(tableName,getAdditionalAuthorizations());
      final ByteArrayRange r=ranges.get(0);
      if (r.isSingleValue()) {
        ((Scanner)scanner).setRange(Range.exact(new Text(r.getStart().getBytes())));
      }
 else {
        ((Scanner)scanner).setRange(AccumuloUtils.byteArrayRangeToAccumuloRange(r));
      }
      if ((limit != null) && (limit > 0) && (limit < ((Scanner)scanner).getBatchSize())) {
        ((Scanner)scanner).setBatchSize(Math.min(1024,limit));
      }
      if (maxResolutionSubsamplingPerDimension != null) {
        if (maxResolutionSubsamplingPerDimension.length != index.getIndexStrategy().getOrderedDimensionDefinitions().length) {
          LOGGER.warn("String_Node_Str" + tableName + "String_Node_Str"+ maxResolutionSubsamplingPerDimension.length+ "String_Node_Str"+ index.getIndexStrategy().getOrderedDimensionDefinitions().length);
        }
 else {
          final int cardinalityToSubsample=(int)Math.round(IndexUtils.getDimensionalBitsUsed(index.getIndexStrategy(),maxResolutionSubsamplingPerDimension) + (8 * index.getIndexStrategy().getByteOffsetFromDimensionalIndex()));
          final IteratorSetting iteratorSettings=new IteratorSetting(FixedCardinalitySkippingIterator.CARDINALITY_SKIPPING_ITERATOR_PRIORITY,FixedCardinalitySkippingIterator.CARDINALITY_SKIPPING_ITERATOR_NAME,FixedCardinalitySkippingIterator.class);
          iteratorSettings.addOption(FixedCardinalitySkippingIterator.CARDINALITY_SKIP_INTERVAL,Integer.toString(cardinalityToSubsample));
          scanner.addScanIterator(iteratorSettings);
        }
      }
    }
 else {
      scanner=accumuloOperations.createBatchScanner(tableName,getAdditionalAuthorizations());
      ((BatchScanner)scanner).setRanges(AccumuloUtils.byteArrayRangesToAccumuloRanges(ranges));
    }
  }
 catch (  final TableNotFoundException e) {
    LOGGER.warn("String_Node_Str" + tableName + "String_Node_Str",e);
    return null;
  }
  if ((adapterIds != null) && !adapterIds.isEmpty()) {
    for (    final ByteArrayId adapterId : adapterIds) {
      scanner.fetchColumnFamily(new Text(adapterId.getBytes()));
    }
  }
  return scanner;
}

Fixed version (ground truth):
protected ScannerBase getScanner(final AccumuloOperations accumuloOperations,final double[] maxResolutionSubsamplingPerDimension,final Integer limit){
  final List<ByteArrayRange> ranges=getRanges();
  final String tableName=StringUtils.stringFromBinary(index.getId().getBytes());
  ScannerBase scanner;
  try {
    if ((ranges != null) && (ranges.size() == 1)) {
      scanner=accumuloOperations.createScanner(tableName,getAdditionalAuthorizations());
      final ByteArrayRange r=ranges.get(0);
      if (r.isSingleValue()) {
        ((Scanner)scanner).setRange(Range.exact(new Text(r.getStart().getBytes())));
      }
 else {
        ((Scanner)scanner).setRange(AccumuloUtils.byteArrayRangeToAccumuloRange(r));
      }
      if ((limit != null) && (limit > 0) && (limit < ((Scanner)scanner).getBatchSize())) {
        ((Scanner)scanner).setBatchSize(Math.min(1024,limit));
      }
    }
 else {
      scanner=accumuloOperations.createBatchScanner(tableName,getAdditionalAuthorizations());
      ((BatchScanner)scanner).setRanges(AccumuloUtils.byteArrayRangesToAccumuloRanges(ranges));
    }
    if (maxResolutionSubsamplingPerDimension != null) {
      if (maxResolutionSubsamplingPerDimension.length != index.getIndexStrategy().getOrderedDimensionDefinitions().length) {
        LOGGER.warn("String_Node_Str" + tableName + "String_Node_Str"+ maxResolutionSubsamplingPerDimension.length+ "String_Node_Str"+ index.getIndexStrategy().getOrderedDimensionDefinitions().length);
      }
 else {
        final int cardinalityToSubsample=(int)Math.round(IndexUtils.getDimensionalBitsUsed(index.getIndexStrategy(),maxResolutionSubsamplingPerDimension) + (8 * index.getIndexStrategy().getByteOffsetFromDimensionalIndex()));
        final IteratorSetting iteratorSettings=new IteratorSetting(FixedCardinalitySkippingIterator.CARDINALITY_SKIPPING_ITERATOR_PRIORITY,FixedCardinalitySkippingIterator.CARDINALITY_SKIPPING_ITERATOR_NAME,FixedCardinalitySkippingIterator.class);
        iteratorSettings.addOption(FixedCardinalitySkippingIterator.CARDINALITY_SKIP_INTERVAL,Integer.toString(cardinalityToSubsample));
        scanner.addScanIterator(iteratorSettings);
      }
    }
  }
 catch (  final TableNotFoundException e) {
    LOGGER.warn("String_Node_Str" + tableName + "String_Node_Str",e);
    return null;
  }
  if ((adapterIds != null) && !adapterIds.isEmpty()) {
    for (    final ByteArrayId adapterId : adapterIds) {
      scanner.fetchColumnFamily(new Text(adapterId.getBytes()));
    }
  }
  return scanner;
}