Program: 112961
Project: 112961
Buggy source:
protected DistributableQueryFilter createFilter(final CommonIndexModel indexModel,final BasicQuery basicQuery){
  NumericDimensionField<?>[] dimensionFields=indexModel.getDimensions();
  NumericData[] orderedConstraintsPerDimension=new NumericData[dimensionFields.length];
  final Set<Integer> fieldsToTrim=new HashSet<Integer>();
  for (int d=0; d < dimensionFields.length; d++) {
    final ConstraintData nd=constraintsPerTypeOfDimensionDefinition.get(dimensionFields[d].getBaseDefinition().getClass());
    if (nd == null) {
      fieldsToTrim.add(d);
    }
 else {
      orderedConstraintsPerDimension[d]=constraintsPerTypeOfDimensionDefinition.get(dimensionFields[d].getBaseDefinition().getClass()).range;
    }
  }
  if (!fieldsToTrim.isEmpty()) {
    final NumericDimensionField<?>[] newDimensionFields=new NumericDimensionField[dimensionFields.length - fieldsToTrim.size()];
    final NumericData[] newOrderedConstraintsPerDimension=new NumericData[newDimensionFields.length];
    int newDimensionCtr=0;
    for (int i=0; i < dimensionFields.length; i++) {
      if (!fieldsToTrim.contains(i)) {
        newDimensionFields[newDimensionCtr]=dimensionFields[i];
        newOrderedConstraintsPerDimension[newDimensionCtr++]=orderedConstraintsPerDimension[i];
      }
    }
    dimensionFields=newDimensionFields;
    orderedConstraintsPerDimension=newOrderedConstraintsPerDimension;
  }
  return basicQuery.createQueryFilter(new BasicNumericDataset(orderedConstraintsPerDimension),dimensionFields);
}

Fixed version (ground truth):
protected DistributableQueryFilter createFilter(final CommonIndexModel indexModel,final BasicQuery basicQuery){
  final NumericDimensionField<?>[] dimensionFields=indexModel.getDimensions();
  NumericDimensionField<?>[] orderedConstrainedDimensionFields=dimensionFields;
  NumericDimensionField<?>[] unconstrainedDimensionFields;
  NumericData[] orderedConstraintsPerDimension=new NumericData[dimensionFields.length];
  final Set<Integer> fieldsToTrim=new HashSet<Integer>();
  for (int d=0; d < dimensionFields.length; d++) {
    final ConstraintData nd=constraintsPerTypeOfDimensionDefinition.get(dimensionFields[d].getBaseDefinition().getClass());
    if (nd == null) {
      fieldsToTrim.add(d);
    }
 else {
      orderedConstraintsPerDimension[d]=constraintsPerTypeOfDimensionDefinition.get(dimensionFields[d].getBaseDefinition().getClass()).range;
    }
  }
  if (!fieldsToTrim.isEmpty()) {
    final NumericDimensionField<?>[] newDimensionFields=new NumericDimensionField[dimensionFields.length - fieldsToTrim.size()];
    unconstrainedDimensionFields=new NumericDimensionField[fieldsToTrim.size()];
    final NumericData[] newOrderedConstraintsPerDimension=new NumericData[newDimensionFields.length];
    int newDimensionCtr=0;
    int constrainedCtr=0;
    for (int i=0; i < dimensionFields.length; i++) {
      if (!fieldsToTrim.contains(i)) {
        newDimensionFields[newDimensionCtr]=dimensionFields[i];
        newOrderedConstraintsPerDimension[newDimensionCtr++]=orderedConstraintsPerDimension[i];
      }
 else {
        unconstrainedDimensionFields[constrainedCtr++]=dimensionFields[i];
      }
    }
    orderedConstrainedDimensionFields=newDimensionFields;
    orderedConstraintsPerDimension=newOrderedConstraintsPerDimension;
  }
 else {
    unconstrainedDimensionFields=new NumericDimensionField[]{};
  }
  return basicQuery.createQueryFilter(new BasicNumericDataset(orderedConstraintsPerDimension),orderedConstrainedDimensionFields,unconstrainedDimensionFields);
}