nus-yam/ex-repair huggingface dataset:
Program: 51250
Project: 51250
Buggy source:
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @return list of members or tuples
 */
private static List ignoreUnrelatedDimensions(List tuplesForAggregation,RolapCube baseCube){
  Set nonJoiningDimensions=nonJoiningDimensions(baseCube,tuplesForAggregation);
  Set processedTuples=new LinkedHashSet(tuplesForAggregation.size());
  for (int i=0; i < tuplesForAggregation.size(); i++) {
    Member[] tuples=copy(tupleAsArray(tuplesForAggregation.get(i)));
    for (int j=0; j < tuples.length; j++) {
      if (nonJoiningDimensions.contains(tuples[j].getDimension().getUniqueName())) {
        final Hierarchy hierarchy=tuples[j].getDimension().getHierarchy();
        if (hierarchy.hasAll()) {
          tuples[j]=hierarchy.getAllMember();
        }
 else {
          tuples[j]=hierarchy.getDefaultMember();
        }
      }
    }
    if (tuplesForAggregation.get(i) instanceof Member[]) {
      processedTuples.add(new MemberArray(tuples));
    }
 else {
      processedTuples.add(tuples[0]);
    }
  }
  return tuplesAsList(processedTuples);
}

Fixed version (ground truth):
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @return list of members or tuples
 */
private static List ignoreUnrelatedDimensions(List tuplesForAggregation,RolapCube baseCube){
  Set<Dimension> nonJoiningDimensions=nonJoiningDimensions(baseCube,tuplesForAggregation);
  Set processedTuples=new LinkedHashSet(tuplesForAggregation.size());
  for (int i=0; i < tuplesForAggregation.size(); i++) {
    Member[] tuples=copy(tupleAsArray(tuplesForAggregation.get(i)));
    for (int j=0; j < tuples.length; j++) {
      if (nonJoiningDimensions.contains(tuples[j].getDimension())) {
        final Hierarchy hierarchy=tuples[j].getDimension().getHierarchy();
        if (hierarchy.hasAll()) {
          tuples[j]=hierarchy.getAllMember();
        }
 else {
          tuples[j]=hierarchy.getDefaultMember();
        }
      }
    }
    if (tuplesForAggregation.get(i) instanceof Member[]) {
      processedTuples.add(new MemberArray(tuples));
    }
 else {
      processedTuples.add(tuples[0]);
    }
  }
  return tuplesAsList(processedTuples);
}
Program: 51251
Project: 51251
Buggy source:
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube. <p>If IgnoreMeasureForNonJoiningDimension is set to true and ignoreUnrelatedDimensions on CubeUsage is set to false then if a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param evaluator
 * @return list of members or tuples
 */
private static List processUnrelatedDimensions(List tuplesForAggregation,Evaluator evaluator){
  RolapMember measure=(RolapMember)evaluator.getMembers()[0];
  if (measure.isCalculated()) {
    return tuplesForAggregation;
  }
  RolapCube virtualCube=(RolapCube)evaluator.getCube();
  RolapCube baseCube=((RolapStoredMeasure)measure).getCube();
  if (virtualCube.shouldIgnoreUnrelatedDimensions(baseCube.getName())) {
    return ignoreUnrelatedDimensions(tuplesForAggregation,baseCube);
  }
 else   if (shouldIgnoreMeasureForNonJoiningDimension()) {
    return ignoreMeasureForNonJoiningDimension(tuplesForAggregation,baseCube);
  }
  return tuplesForAggregation;
}

Fixed version (ground truth):
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube. <p>If IgnoreMeasureForNonJoiningDimension is set to true and ignoreUnrelatedDimensions on CubeUsage is set to false then if a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param evaluator
 * @return list of members or tuples
 */
private static List processUnrelatedDimensions(List tuplesForAggregation,Evaluator evaluator){
  RolapMember measure=(RolapMember)evaluator.getMembers()[0];
  if (measure.isCalculated()) {
    return tuplesForAggregation;
  }
  RolapCube virtualCube=(RolapCube)evaluator.getCube();
  RolapCube baseCube=((RolapStoredMeasure)measure).getCube();
  if (virtualCube.shouldIgnoreUnrelatedDimensions(baseCube.getName())) {
    return ignoreUnrelatedDimensions(tuplesForAggregation,baseCube);
  }
 else   if (MondrianProperties.instance().IgnoreMeasureForNonJoiningDimension.get()) {
    return ignoreMeasureForNonJoiningDimension(tuplesForAggregation,baseCube);
  }
  return tuplesForAggregation;
}
Program: 51252
Project: 51252
Buggy source:
/** 
 * If a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param baseCube
 * @return list of members or tuples
 */
private static List ignoreMeasureForNonJoiningDimension(List tuplesForAggregation,RolapCube baseCube){
  Set nonJoiningDimensions=nonJoiningDimensions(baseCube,tuplesForAggregation);
  if (nonJoiningDimensions.size() > 0) {
    return new ArrayList();
  }
  return tuplesForAggregation;
}

Fixed version (ground truth):
/** 
 * If a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param baseCube
 * @return list of members or tuples
 */
private static List ignoreMeasureForNonJoiningDimension(List tuplesForAggregation,RolapCube baseCube){
  Set<Dimension> nonJoiningDimensions=nonJoiningDimensions(baseCube,tuplesForAggregation);
  if (nonJoiningDimensions.size() > 0) {
    return new ArrayList();
  }
  return tuplesForAggregation;
}
Program: 51253
Project: 51253
Buggy source:
private List<Dimension> getDimensionsToForceToAllLevel(RolapCube virtualCube,RolapCube baseCube,Member[] memberArray){
  List<Dimension> vMinusBDimensions=new ArrayList<Dimension>();
  boolean foundDim;
  for (int i=0; i < virtualCube.getDimensions().length; i++) {
    foundDim=false;
    for (int j=0; j < baseCube.getDimensions().length; j++) {
      if (virtualCube.getDimensions()[i].getName().equals(baseCube.getDimensions()[j].getName())) {
        foundDim=true;
        break;
      }
    }
    if (!foundDim && !isDimInMembersArray(memberArray,virtualCube.getDimensions()[i])) {
      vMinusBDimensions.add(virtualCube.getDimensions()[i]);
    }
  }
  return vMinusBDimensions;
}

Fixed version (ground truth):
private List<Dimension> getDimensionsToForceToAllLevel(RolapCube virtualCube,RolapCube baseCube,Member[] memberArray){
  List<Dimension> vMinusBDimensions=new ArrayList<Dimension>();
  Set<Dimension> virtualCubeDims=new HashSet<Dimension>();
  virtualCubeDims.addAll(Arrays.asList(virtualCube.getDimensions()));
  Set<Dimension> nonJoiningDims=baseCube.nonJoiningDimensions(virtualCubeDims);
  for (  Dimension nonJoiningDim : nonJoiningDims) {
    if (!isDimInMembersArray(memberArray,nonJoiningDim)) {
      vMinusBDimensions.add(nonJoiningDim);
    }
  }
  return vMinusBDimensions;
}
Program: 51254
Project: 51254
Buggy source:
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof RolapCubeHierarchy)) {
    return false;
  }
  RolapCubeDimension that=(RolapCubeDimension)o;
  if (!parent.equals(that.parent)) {
    return false;
  }
 else {
    return getUniqueName().equals(that.getUniqueName());
  }
}

Fixed version (ground truth):
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof RolapCubeDimension)) {
    return false;
  }
  RolapCubeDimension that=(RolapCubeDimension)o;
  if (!parent.equals(that.parent)) {
    return false;
  }
 else {
    return getUniqueName().equals(that.getUniqueName());
  }
}
Program: 51255
Project: 51255
Buggy source:
public RolapCubeDimension(RolapCube parent,RolapDimension rolapDim,MondrianDef.CubeDimension cubeDim,String name,int cubeOrdinal){
  super(null,name,null);
  this.xmlDimension=cubeDim;
  this.rolapDimension=rolapDim;
  this.cubeOrdinal=cubeOrdinal;
  this.parent=parent;
  hierarchies=new RolapCubeHierarchy[rolapDim.getHierarchies().length];
  for (int i=0; i < rolapDim.getHierarchies().length; i++) {
    hierarchies[i]=new RolapCubeHierarchy(this,cubeDim,(RolapHierarchy)rolapDim.getHierarchies()[i],((HierarchyBase)rolapDim.getHierarchies()[i]).getSubName());
  }
}

Fixed version (ground truth):
public RolapCubeDimension(RolapCube parent,RolapDimension rolapDim,MondrianDef.CubeDimension cubeDim,String name,int cubeOrdinal){
  super(null,name,null);
  this.xmlDimension=cubeDim;
  this.rolapDimension=rolapDim;
  this.cubeOrdinal=cubeOrdinal;
  this.parent=parent;
  this.caption=cubeDim.caption;
  hierarchies=new RolapCubeHierarchy[rolapDim.getHierarchies().length];
  for (int i=0; i < rolapDim.getHierarchies().length; i++) {
    hierarchies[i]=new RolapCubeHierarchy(this,cubeDim,(RolapHierarchy)rolapDim.getHierarchies()[i],((HierarchyBase)rolapDim.getHierarchies()[i]).getSubName());
  }
}
Program: 51256
Project: 51256
Buggy source:
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof RolapCubeDimension)) {
    return false;
  }
  RolapCubeDimension that=(RolapCubeDimension)o;
  if (!parent.equals(that.parent)) {
    return false;
  }
 else {
    return getUniqueName().equals(that.getUniqueName());
  }
}

Fixed version (ground truth):
public boolean equals(Object o){
  if (this == o) {
    return true;
  }
  if (!(o instanceof RolapCubeDimension)) {
    return false;
  }
  RolapCubeDimension that=(RolapCubeDimension)o;
  if (!parent.equals(that.parent)) {
    return false;
  }
  return getUniqueName().equals(that.getUniqueName());
}
Program: 51257
Project: 51257
Buggy source:
public String getCaption(){
  return rolapDimension.getCaption();
}

Fixed version (ground truth):
public String getCaption(){
  if (caption != null) {
    return caption;
  }
  return rolapDimension.getCaption();
}
Program: 51258
Project: 51258
Buggy source:
/** 
 * Test to verify naming of all member with  dimension usage name is different then source name
 */
public void testAllMemberMultipleDimensionUsages(){
  TestContext testContext=TestContext.create(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null,null,null,null);
  testContext.assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Test to verify naming of all member with  dimension usage name is different then source name
 */
public void testAllMemberMultipleDimensionUsages(){
  TestContext testContext=TestContext.create(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null,null,null,null);
  testContext.assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  final Result result=testContext.executeQuery("String_Node_Str" + "String_Node_Str");
  final Axis axis=result.getAxes()[0];
  final Position position=axis.getPositions().get(0);
  assertEquals("String_Node_Str",position.get(0).getDimension().getCaption());
  assertEquals("String_Node_Str",position.get(1).getDimension().getCaption());
}
Program: 51259
Project: 51259
Buggy source:
private void addColumnName(final RolapStar.Column column,final List<String> columnNames,final Set<String> columnNameSet){
  String columnName=column.getName();
  if (columnName != null) {
  }
 else   if (column.getExpression() instanceof MondrianDef.Column) {
    columnName=((MondrianDef.Column)column.getExpression()).name;
  }
 else {
    columnName="String_Node_Str" + Integer.toString(columnNames.size());
  }
  for (int j=0; !columnNameSet.add(columnName); j++) {
    columnName=columnName + "String_Node_Str" + Integer.toString(j);
  }
  columnNames.add(columnName);
}

Fixed version (ground truth):
private void addColumnName(final RolapStar.Column column,final List<String> columnNames,final Set<String> columnNameSet){
  String columnName=column.getName();
  if (columnName != null) {
  }
 else   if (column.getExpression() instanceof MondrianDef.Column) {
    columnName=((MondrianDef.Column)column.getExpression()).name;
  }
 else {
    columnName="String_Node_Str" + Integer.toString(columnNames.size());
  }
  String originalColumnName=columnName;
  if (columnName.length() > maxColumnNameLength) {
    columnName=columnName.substring(0,maxColumnNameLength);
  }
  for (int j=0; !columnNameSet.add(columnName); j++) {
    final String suffix="String_Node_Str" + Integer.toString(j);
    columnName=originalColumnName;
    if (originalColumnName.length() + suffix.length() > maxColumnNameLength) {
      columnName=originalColumnName.substring(0,maxColumnNameLength - suffix.length());
    }
    columnName+=suffix;
  }
  columnNames.add(columnName);
}
Program: 51260
Project: 51260
Buggy source:
public String getColumnAlias(final int i){
  return columnNames[i];
}

Fixed version (ground truth):
public String getColumnAlias(final int i){
  return columnNames.get(i);
}
Program: 51261
Project: 51261
Buggy source:
private String[] computeDistinctColumnNames(){
  final List<String> columnNames=new ArrayList<String>();
  final Set<String> columnNameSet=new HashSet<String>();
  final RolapStar.Column[] columns=getColumns();
  for (  RolapStar.Column column : columns) {
    addColumnName(column,columnNames,columnNameSet);
  }
  addColumnName(request.getMeasure(),columnNames,columnNameSet);
  return columnNames.toArray(new String[columnNames.size()]);
}

Fixed version (ground truth):
private List<String> computeDistinctColumnNames(){
  final List<String> columnNames=new ArrayList<String>();
  final Set<String> columnNameSet=new HashSet<String>();
  final RolapStar.Column[] columns=getColumns();
  for (  RolapStar.Column column : columns) {
    addColumnName(column,columnNames,columnNameSet);
  }
  addColumnName(request.getMeasure(),columnNames,columnNameSet);
  return columnNames;
}
Program: 51262
Project: 51262
Buggy source:
public String getMeasureAlias(final int i){
  Util.assertTrue(i == 0);
  return columnNames[columnNames.length - 1];
}

Fixed version (ground truth):
public String getMeasureAlias(final int i){
  Util.assertTrue(i == 0);
  return columnNames.get(columnNames.size() - 1);
}
Program: 51263
Project: 51263
Buggy source:
public DrillThroughQuerySpec(CellRequest request,boolean countOnly){
  super(request.getMeasure().getStar(),countOnly);
  this.request=request;
  this.columnNames=computeDistinctColumnNames();
}

Fixed version (ground truth):
public DrillThroughQuerySpec(CellRequest request,boolean countOnly){
  super(request.getMeasure().getStar(),countOnly);
  this.request=request;
  this.maxColumnNameLength=getStar().getSqlQueryDialect().getMaxColumnNameLength();
  this.columnNames=computeDistinctColumnNames();
}
Program: 51264
Project: 51264
Buggy source:
Dialect(String quoteIdentifierString,String productName,String productVersion,Set<List<Integer>> supportedResultSetTypes,boolean readOnly){
  this.quoteIdentifierString=quoteIdentifierString;
  this.productName=productName;
  this.productVersion=productVersion;
  this.supportedResultSetTypes=supportedResultSetTypes;
  this.readOnly=readOnly;
}

Fixed version (ground truth):
Dialect(String quoteIdentifierString,String productName,String productVersion,Set<List<Integer>> supportedResultSetTypes,boolean readOnly,int maxColumnNameLength){
  this.quoteIdentifierString=quoteIdentifierString;
  this.productName=productName;
  this.productVersion=productVersion;
  this.supportedResultSetTypes=supportedResultSetTypes;
  this.readOnly=readOnly;
  this.maxColumnNameLength=maxColumnNameLength;
}
Program: 51265
Project: 51265
Buggy source:
/** 
 * Looks up a member whose unique name is <code>memberUniqueName</code> from cache. If the member is not in cache, returns null.
 */
public Member lookupMemberFromCache(String memberUniqueName){
  for (  Member member : getDefinedMembers()) {
    if (Util.equalName(member.getUniqueName(),memberUniqueName)) {
      return member;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Looks up a member whose unique name is <code>memberUniqueName</code>  from cache. If the member is not in cache, returns null.
 */
public Member lookupMemberFromCache(String memberUniqueName){
  for (  Member member : getDefinedMembers()) {
    if (Util.equalName(member.getUniqueName(),memberUniqueName) || Util.equalName(getUniqueNameWithoutAll(member),memberUniqueName)) {
      return member;
    }
  }
  return null;
}
Program: 51266
Project: 51266
Buggy source:
public TupleValueCalc(Exp exp,TupleCalc tupleCalc){
  super(exp);
  this.tupleCalc=tupleCalc;
  final TupleType tupleType=(TupleType)this.tupleCalc.getType();
  this.savedMembers=new Member[tupleType.elementTypes.length];
}

Fixed version (ground truth):
public TupleValueCalc(Exp exp,TupleCalc tupleCalc){
  super(exp);
  this.tupleCalc=tupleCalc;
}
Program: 51267
Project: 51267
Buggy source:
public Object evaluate(Evaluator evaluator){
  final Member[] members=tupleCalc.evaluateTuple(evaluator);
  if (members == null) {
    return null;
  }
  for (int i=0; i < members.length; i++) {
    savedMembers[i]=evaluator.setContext(members[i]);
  }
  final Object o=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return o;
}

Fixed version (ground truth):
public Object evaluate(Evaluator evaluator){
  final Member[] members=tupleCalc.evaluateTuple(evaluator);
  if (members == null) {
    return null;
  }
  Member[] savedMembers=new Member[members.length];
  for (int i=0; i < members.length; i++) {
    savedMembers[i]=evaluator.setContext(members[i]);
  }
  final Object o=evaluator.evaluateCurrent();
  evaluator.setContext(savedMembers);
  return o;
}
Program: 51269
Project: 51269
Buggy source:
public Type computeCommonType(Type type,int[] conversionCount){
  if (type instanceof ScalarType) {
    return getValueType().computeCommonType(type,conversionCount);
  }
  if (type instanceof TupleType) {
    TupleType tupleType=(TupleType)type;
    if (tupleType.elementTypes.length == 1) {
      return new TupleType(new Type[]{type}).computeCommonType(tupleType,conversionCount);
    }
 else {
      return computeCommonType(tupleType.getValueType(),conversionCount);
    }
  }
  if (!(type instanceof MemberType)) {
    return null;
  }
  MemberType that=(MemberType)type;
  if (this.getMember() != null && this.getMember().equals(that.getMember())) {
    return this;
  }
  if (this.getLevel() != null && this.getLevel().equals(that.getLevel())) {
    return new MemberType(this.getDimension(),this.getHierarchy(),this.getLevel(),null);
  }
  if (this.getHierarchy() != null && this.getHierarchy().equals(that.getHierarchy())) {
    return new MemberType(this.getDimension(),this.getHierarchy(),null,null);
  }
  if (this.getDimension() != null && this.getDimension().equals(that.getDimension())) {
    return new MemberType(this.getDimension(),null,null,null);
  }
  return MemberType.Unknown;
}

Fixed version (ground truth):
public Type computeCommonType(Type type,int[] conversionCount){
  if (type instanceof ScalarType) {
    return getValueType().computeCommonType(type,conversionCount);
  }
  if (type instanceof TupleType) {
    return type.computeCommonType(this,conversionCount);
  }
  if (!(type instanceof MemberType)) {
    return null;
  }
  MemberType that=(MemberType)type;
  if (this.getMember() != null && this.getMember().equals(that.getMember())) {
    return this;
  }
  if (this.getLevel() != null && this.getLevel().equals(that.getLevel())) {
    return new MemberType(this.getDimension(),this.getHierarchy(),this.getLevel(),null);
  }
  if (this.getHierarchy() != null && this.getHierarchy().equals(that.getHierarchy())) {
    return new MemberType(this.getDimension(),this.getHierarchy(),null,null);
  }
  if (this.getDimension() != null && this.getDimension().equals(that.getDimension())) {
    return new MemberType(this.getDimension(),null,null,null);
  }
  return MemberType.Unknown;
}
Program: 51270
Project: 51270
Buggy source:
public boolean usesDimension(Dimension dimension,boolean definitely){
  if (elementType == null || elementType instanceof ScalarType) {
    return definitely;
  }
  return elementType.usesDimension(dimension,definitely);
}

Fixed version (ground truth):
public boolean usesDimension(Dimension dimension,boolean definitely){
  if (elementType == null) {
    return definitely;
  }
  return elementType.usesDimension(dimension,definitely);
}
Program: 51271
Project: 51271
Buggy source:
public Type computeCommonType(Type type,int[] conversionCount){
  if (type instanceof ScalarType) {
    return getValueType().computeCommonType(type,conversionCount);
  }
  if (type instanceof MemberType) {
    return getValueType().computeCommonType(type,conversionCount);
  }
  if (!(type instanceof TupleType)) {
    return null;
  }
  TupleType that=(TupleType)type;
  if (this.elementTypes.length != that.elementTypes.length) {
    return null;
  }
  final Type[] elementTypes=new Type[this.elementTypes.length];
  for (int i=0; i < elementTypes.length; i++) {
    elementTypes[i]=this.elementTypes[i].computeCommonType(that.elementTypes[i],conversionCount);
    if (elementTypes[i] == null) {
      return null;
    }
  }
  return new TupleType(elementTypes);
}

Fixed version (ground truth):
public Type computeCommonType(Type type,int[] conversionCount){
  if (type instanceof ScalarType) {
    return getValueType().computeCommonType(type,conversionCount);
  }
  if (type instanceof MemberType) {
    return commonTupleType(new TupleType(new Type[]{type}),conversionCount);
  }
  if (!(type instanceof TupleType)) {
    return null;
  }
  return commonTupleType(type,conversionCount);
}
Program: 51273
Project: 51273
Buggy source:
public void testCommonTypeWhenSetTypeHavingMemberTypeAndTupleType(){
  MemberType measureMemberType=getMemberTypeHavingMeasureInIt(getUnitSalesMeasure());
  MemberType genderMemberType=getMemberTypeHavingMaleChild(getMaleChild());
  MemberType storeMemberType=getStoreMemberType(getStoreChild());
  TupleType tupleType=new TupleType(new Type[]{storeMemberType,genderMemberType});
  SetType setTypeWithMember=new SetType(measureMemberType);
  SetType setTypeWithTuple=new SetType(tupleType);
  Type type1=setTypeWithMember.computeCommonType(setTypeWithTuple,null);
  Type type2=setTypeWithTuple.computeCommonType(setTypeWithMember,null);
  assertNotNull(type1);
  assertNotNull(type2);
  assertTrue(((SetType)type1).getElementType() instanceof ScalarType);
  assertTrue(((SetType)type2).getElementType() instanceof ScalarType);
  assertEquals(type1,type2);
}

Fixed version (ground truth):
public void testCommonTypeWhenSetTypeHavingMemberTypeAndTupleType(){
  MemberType measureMemberType=getMemberTypeHavingMeasureInIt(getUnitSalesMeasure());
  MemberType genderMemberType=getMemberTypeHavingMaleChild(getMaleChild());
  MemberType storeMemberType=getStoreMemberType(getStoreChild());
  TupleType tupleType=new TupleType(new Type[]{storeMemberType,genderMemberType});
  SetType setTypeWithMember=new SetType(measureMemberType);
  SetType setTypeWithTuple=new SetType(tupleType);
  Type type1=setTypeWithMember.computeCommonType(setTypeWithTuple,null);
  assertNotNull(type1);
  assertTrue(((SetType)type1).getElementType() instanceof TupleType);
  Type type2=setTypeWithTuple.computeCommonType(setTypeWithMember,null);
  assertNotNull(type2);
  assertTrue(((SetType)type2).getElementType() instanceof TupleType);
  assertEquals(type1,type2);
}
Program: 51274
Project: 51274
Buggy source:
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube. <p>If IgnoreMeasureForNonJoiningDimension is set to true and ignoreUnrelatedDimensions on CubeUsage is set to false then if a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param evaluator
 * @return list of members or tuples
 */
private static List processUnrelatedDimensions(List tuplesForAggregation,Evaluator evaluator){
  RolapMember measure=(RolapMember)evaluator.getMembers()[0];
  if (measure.isCalculated()) {
    return tuplesForAggregation;
  }
  RolapCube virtualCube=(RolapCube)evaluator.getCube();
  RolapCube baseCube=(RolapCube)evaluator.getMeasureCube();
  if (virtualCube.isVirtual() && baseCube != null) {
    if (virtualCube.shouldIgnoreUnrelatedDimensions(baseCube.getName())) {
      return ignoreUnrelatedDimensions(tuplesForAggregation,baseCube);
    }
 else     if (MondrianProperties.instance().IgnoreMeasureForNonJoiningDimension.get()) {
      return ignoreMeasureForNonJoiningDimension(tuplesForAggregation,baseCube);
    }
  }
  return tuplesForAggregation;
}

Fixed version (ground truth):
/** 
 * Pushes unrelated dimensions to the top level member from the given list of tuples if the ignoreUnrelatedDimensions property is set on the base cube usage in the virtual cube. <p>If IgnoreMeasureForNonJoiningDimension is set to true and ignoreUnrelatedDimensions on CubeUsage is set to false then if a non joining dimension exists in the aggregation list then return an empty list else return the original list.
 * @param tuplesForAggregation is a list of members or tuples used incomputing the aggregate
 * @param evaluator
 * @return list of members or tuples
 */
private static List processUnrelatedDimensions(List tuplesForAggregation,Evaluator evaluator){
  if (tuplesForAggregation.size() == 0) {
    return tuplesForAggregation;
  }
  RolapMember measure=(RolapMember)evaluator.getMembers()[0];
  if (measure.isCalculated()) {
    return tuplesForAggregation;
  }
  RolapCube virtualCube=(RolapCube)evaluator.getCube();
  RolapCube baseCube=(RolapCube)evaluator.getMeasureCube();
  if (virtualCube.isVirtual() && baseCube != null) {
    if (virtualCube.shouldIgnoreUnrelatedDimensions(baseCube.getName())) {
      return ignoreUnrelatedDimensions(tuplesForAggregation,baseCube);
    }
 else     if (MondrianProperties.instance().IgnoreMeasureForNonJoiningDimension.get()) {
      return ignoreMeasureForNonJoiningDimension(tuplesForAggregation,baseCube);
    }
  }
  return tuplesForAggregation;
}
Program: 51275
Project: 51275
Buggy source:
public void testQueryTimeout(){
  final TestContext tc=TestContext.create(null,null,null,null,"String_Node_Str" + SleepUdf.class.getName() + "String_Node_Str",null);
  String query="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Throwable throwable=null;
  int origTimeout=MondrianProperties.instance().QueryTimeout.get();
  try {
    MondrianProperties.instance().QueryTimeout.set(2);
    tc.executeQuery(query);
  }
 catch (  Throwable ex) {
    throwable=ex;
  }
 finally {
    MondrianProperties.instance().QueryTimeout.set(origTimeout);
  }
  TestContext.checkThrowable(throwable,"String_Node_Str");
}

Fixed version (ground truth):
public void testQueryTimeout(){
  final TestContext tc=TestContext.create(null,null,null,null,"String_Node_Str" + SleepUdf.class.getName() + "String_Node_Str",null);
  String query="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Throwable throwable=null;
  int origTimeout=props.QueryTimeout.get();
  try {
    props.QueryTimeout.set(2);
    tc.executeQuery(query);
  }
 catch (  Throwable ex) {
    throwable=ex;
  }
 finally {
    props.QueryTimeout.set(origTimeout);
  }
  TestContext.checkThrowable(throwable,"String_Node_Str");
}
Program: 51276
Project: 51276
Buggy source:
/** 
 * Tests a query with a CrossJoin so large that we run out of memory unless we can push down evaluation to SQL.
 */
public void testNonEmptyCrossJoin(){
  if (!MondrianProperties.instance().EnableNativeCrossJoin.get()) {
    return;
  }
  getConnection().getCacheControl(null).flushSchemaCache();
  Result result=executeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  Axis a=result.getAxes()[1];
  assertEquals(67,a.getPositions().size());
}

Fixed version (ground truth):
/** 
 * Tests a query with a CrossJoin so large that we run out of memory unless we can push down evaluation to SQL.
 */
public void testNonEmptyCrossJoin(){
  if (!props.EnableNativeCrossJoin.get()) {
    return;
  }
  getConnection().getCacheControl(null).flushSchemaCache();
  Result result=executeQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  Axis a=result.getAxes()[1];
  assertEquals(67,a.getPositions().size());
}
Program: 51277
Project: 51277
Buggy source:
public void testMemberOrdinalCaching(){
  final MondrianProperties properties=MondrianProperties.instance();
  boolean saved=properties.CompareSiblingsByOrderKey.get();
  properties.CompareSiblingsByOrderKey.set(true);
  Connection conn=null;
  try {
    conn=getTestContext().getFoodMartConnection(false);
    TestContext context=getTestContext(conn);
    tryMemberOrdinalCaching(context);
  }
  finally {
    properties.CompareSiblingsByOrderKey.set(saved);
    if (conn != null) {
      conn.close();
    }
  }
}

Fixed version (ground truth):
public void testMemberOrdinalCaching(){
  boolean saved=props.CompareSiblingsByOrderKey.get();
  props.CompareSiblingsByOrderKey.set(true);
  Connection conn=null;
  try {
    conn=getTestContext().getFoodMartConnection(false);
    TestContext context=getTestContext(conn);
    tryMemberOrdinalCaching(context);
  }
  finally {
    props.CompareSiblingsByOrderKey.set(saved);
    if (conn != null) {
      conn.close();
    }
  }
}
Program: 51278
Project: 51278
Buggy source:
public void testMembersOfLargeDimensionTheHardWay(){
  final MondrianProperties properties=MondrianProperties.instance();
  if (Bug.avoidMemoryOverflow(TestContext.instance().getDialect())) {
    return;
  }
  int old=properties.LargeDimensionThreshold.get();
  try {
    MondrianProperties.instance().LargeDimensionThreshold.set(1);
    final Connection connection=TestContext.instance().getFoodMartConnection();
    String queryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
    Query query=connection.parseQuery(queryString);
    Result result=connection.execute(query);
    assertEquals(10407,result.getAxes()[1].getPositions().size());
  }
  finally {
    MondrianProperties.instance().LargeDimensionThreshold.set(old);
  }
}

Fixed version (ground truth):
public void testMembersOfLargeDimensionTheHardWay(){
  if (Bug.avoidMemoryOverflow(TestContext.instance().getDialect())) {
    return;
  }
  int old=props.LargeDimensionThreshold.get();
  try {
    props.LargeDimensionThreshold.set(1);
    final Connection connection=TestContext.instance().getFoodMartConnection();
    String queryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
    Query query=connection.parseQuery(queryString);
    Result result=connection.execute(query);
    assertEquals(10407,result.getAxes()[1].getPositions().size());
  }
  finally {
    props.LargeDimensionThreshold.set(old);
  }
}
Program: 51279
Project: 51279
Buggy source:
public void testInvalidMembersInQuery(){
  String mdx="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  String mdx2="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  assertThrows(mdx,"String_Node_Str");
  final MondrianProperties properties=MondrianProperties.instance();
  boolean savedInvalidProp=properties.IgnoreInvalidMembersDuringQuery.get();
  String savedAlertProp=properties.AlertNativeEvaluationUnsupported.get();
  try {
    properties.IgnoreInvalidMembersDuringQuery.set(true);
    assertQueryReturns(mdx,fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
    properties.AlertNativeEvaluationUnsupported.set("String_Node_Str");
    assertQueryReturns(mdx2,fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  }
  finally {
    properties.IgnoreInvalidMembersDuringQuery.set(savedInvalidProp);
    properties.AlertNativeEvaluationUnsupported.set(savedAlertProp);
  }
}

Fixed version (ground truth):
public void testInvalidMembersInQuery(){
  String mdx="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  String mdx2="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  assertThrows(mdx,"String_Node_Str");
  boolean savedInvalidProp=props.IgnoreInvalidMembersDuringQuery.get();
  String savedAlertProp=props.AlertNativeEvaluationUnsupported.get();
  try {
    props.IgnoreInvalidMembersDuringQuery.set(true);
    assertQueryReturns(mdx,fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
    props.AlertNativeEvaluationUnsupported.set("String_Node_Str");
    assertQueryReturns(mdx2,fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  }
  finally {
    props.IgnoreInvalidMembersDuringQuery.set(savedInvalidProp);
    props.AlertNativeEvaluationUnsupported.set(savedAlertProp);
  }
}
Program: 51280
Project: 51280
Buggy source:
/** 
 * Turn off aggregate caching and run query with both use of aggregate tables on and off - should result in the same answer. Note that if the "mondrian.rolap.aggregates.Read" property is not true, then no aggregate tables is be read in any event.
 */
public void testCountDistinctAgg(){
  final MondrianProperties properties=MondrianProperties.instance();
  boolean use_agg_orig=properties.UseAggregates.get();
  boolean do_caching_orig=properties.DisableCaching.get();
  properties.DisableCaching.setString("String_Node_Str");
  assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  if (use_agg_orig) {
    properties.UseAggregates.setString("String_Node_Str");
  }
 else {
    properties.UseAggregates.setString("String_Node_Str");
  }
  assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  if (use_agg_orig) {
    properties.UseAggregates.setString("String_Node_Str");
  }
 else {
    properties.UseAggregates.setString("String_Node_Str");
  }
  if (do_caching_orig) {
    properties.DisableCaching.setString("String_Node_Str");
  }
 else {
    properties.DisableCaching.setString("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Turn off aggregate caching and run query with both use of aggregate tables on and off - should result in the same answer. Note that if the "mondrian.rolap.aggregates.Read" property is not true, then no aggregate tables is be read in any event.
 */
public void testCountDistinctAgg(){
  boolean use_agg_orig=props.UseAggregates.get();
  boolean do_caching_orig=props.DisableCaching.get();
  props.DisableCaching.setString("String_Node_Str");
  assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  if (use_agg_orig) {
    props.UseAggregates.setString("String_Node_Str");
  }
 else {
    props.UseAggregates.setString("String_Node_Str");
  }
  assertQueryReturns("String_Node_Str" + "String_Node_Str" + "String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"));
  if (use_agg_orig) {
    props.UseAggregates.setString("String_Node_Str");
  }
 else {
    props.UseAggregates.setString("String_Node_Str");
  }
  if (do_caching_orig) {
    props.DisableCaching.setString("String_Node_Str");
  }
 else {
    props.DisableCaching.setString("String_Node_Str");
  }
}
Program: 51281
Project: 51281
Buggy source:
public void testCatalogHierarchyBasedOnView(){
  if (MondrianProperties.instance().ReadAggregates.get()) {
    return;
  }
  TestContext testContext=TestContext.createSubstitutingCube("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null);
  if (!testContext.getDialect().allowsFromQuery()) {
    return;
  }
  testContext.assertAxisReturns("String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}

Fixed version (ground truth):
public void testCatalogHierarchyBasedOnView(){
  if (props.ReadAggregates.get()) {
    return;
  }
  TestContext testContext=TestContext.createSubstitutingCube("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null);
  if (!testContext.getDialect().allowsFromQuery()) {
    return;
  }
  testContext.assertAxisReturns("String_Node_Str",fold("String_Node_Str" + "String_Node_Str" + "String_Node_Str"));
}
Program: 51283
Project: 51283
Buggy source:
public void testDefaultMeasureInCubeForCaseSensitivity(){
  TestContext testContext=TestContext.create(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null,null,null,null);
  String queryWithoutFilter="String_Node_Str" + "String_Node_Str";
  String queryWithFirstMeasure="String_Node_Str" + "String_Node_Str";
  String queryWithDefaultMeasureFilter="String_Node_Str" + "String_Node_Str";
  if (MondrianProperties.instance().CaseSensitive.get()) {
    assertQueriesReturnSimilarResults(queryWithoutFilter,queryWithFirstMeasure,testContext);
  }
 else {
    assertQueriesReturnSimilarResults(queryWithoutFilter,queryWithDefaultMeasureFilter,testContext);
  }
}

Fixed version (ground truth):
public void testDefaultMeasureInCubeForCaseSensitivity(){
  TestContext testContext=TestContext.create(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",null,null,null,null);
  String queryWithoutFilter="String_Node_Str" + "String_Node_Str";
  String queryWithFirstMeasure="String_Node_Str" + "String_Node_Str";
  String queryWithDefaultMeasureFilter="String_Node_Str" + "String_Node_Str";
  if (props.CaseSensitive.get()) {
    assertQueriesReturnSimilarResults(queryWithoutFilter,queryWithFirstMeasure,testContext);
  }
 else {
    assertQueriesReturnSimilarResults(queryWithoutFilter,queryWithDefaultMeasureFilter,testContext);
  }
}
Program: 51285
Project: 51285
Buggy source:
public void testQueryIterationLimit(){
  String queryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Throwable throwable=null;
  int origLimit=MondrianProperties.instance().IterationLimit.get();
  try {
    MondrianProperties.instance().IterationLimit.set(11);
    Connection connection=getConnection();
    Query query=connection.parseQuery(queryString);
    query.setResultStyle(ResultStyle.LIST);
    connection.execute(query);
  }
 catch (  Throwable ex) {
    throwable=ex;
  }
 finally {
    MondrianProperties.instance().IterationLimit.set(origLimit);
  }
  TestContext.checkThrowable(throwable,"String_Node_Str");
  executeQuery(queryString);
}

Fixed version (ground truth):
public void testQueryIterationLimit(){
  String queryString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Throwable throwable=null;
  int origLimit=props.IterationLimit.get();
  try {
    props.IterationLimit.set(11);
    Connection connection=getConnection();
    Query query=connection.parseQuery(queryString);
    query.setResultStyle(ResultStyle.LIST);
    connection.execute(query);
  }
 catch (  Throwable ex) {
    throwable=ex;
  }
 finally {
    props.IterationLimit.set(origLimit);
  }
  TestContext.checkThrowable(throwable,"String_Node_Str");
  executeQuery(queryString);
}
Program: 51286
Project: 51286
Buggy source:
public IntegerCalc compileInteger(Exp exp){
  final Calc calc=compileScalar(exp,false);
  final Type type=calc.getType();
  if (type instanceof DecimalType && ((DecimalType)type).getScale() == 0) {
    return (IntegerCalc)calc;
  }
 else   if (type instanceof NumericType) {
    if (calc instanceof ConstantCalc) {
      ConstantCalc constantCalc=(ConstantCalc)calc;
      return new ConstantCalc(new DecimalType(Integer.MAX_VALUE,0),constantCalc.evaluateInteger(null));
    }
    final DoubleCalc doubleCalc=(DoubleCalc)calc;
    return new AbstractIntegerCalc(exp,new Calc[]{doubleCalc}){
      public int evaluateInteger(      Evaluator evaluator){
        return (int)doubleCalc.evaluateDouble(evaluator);
      }
    }
;
  }
 else {
    return (IntegerCalc)calc;
  }
}

Fixed version (ground truth):
public IntegerCalc compileInteger(Exp exp){
  final Calc calc=compileScalar(exp,false);
  final Type type=calc.getType();
  if (type instanceof DecimalType && ((DecimalType)type).getScale() == 0) {
    return (IntegerCalc)calc;
  }
 else   if (type instanceof NumericType) {
    if (calc instanceof ConstantCalc) {
      ConstantCalc constantCalc=(ConstantCalc)calc;
      return new ConstantCalc(new DecimalType(Integer.MAX_VALUE,0),constantCalc.evaluateInteger(null));
    }
 else     if (calc instanceof DoubleCalc) {
      final DoubleCalc doubleCalc=(DoubleCalc)calc;
      return new AbstractIntegerCalc(exp,new Calc[]{doubleCalc}){
        public int evaluateInteger(        Evaluator evaluator){
          return (int)doubleCalc.evaluateDouble(evaluator);
        }
      }
;
    }
  }
  return (IntegerCalc)calc;
}
Program: 51287
Project: 51287
Buggy source:
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled()) {
    return null;
  }
  if (!FilterConstraint.isValidContext(evaluator)) {
    return null;
  }
  String funName=fun.getName();
  if (!"String_Node_Str".equalsIgnoreCase(funName)) {
    return null;
  }
  if (args.length != 2) {
    return null;
  }
  CrossJoinArg[] cargs=checkCrossJoinArg(evaluator,args[0]);
  if (cargs == null) {
    return null;
  }
  if (isPreferInterpreter(cargs,false)) {
    return null;
  }
  SchemaReader schemaReader=evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  SqlQuery sqlQuery=SqlQuery.newQuery(ds,"String_Node_Str");
  RolapNativeSql sql=new RolapNativeSql(sqlQuery);
  String filterExpr=sql.generateFilterCondition(args[1]);
  if (filterExpr == null) {
    return null;
  }
  LOGGER.debug("String_Node_Str");
  evaluator=overrideContext(evaluator,cargs,sql.getStoredMeasure());
  TupleConstraint constraint=new FilterConstraint(cargs,evaluator,filterExpr);
  return new SetEvaluator(cargs,schemaReader,constraint);
}

Fixed version (ground truth):
NativeEvaluator createEvaluator(RolapEvaluator evaluator,FunDef fun,Exp[] args){
  if (!isEnabled()) {
    return null;
  }
  if (!FilterConstraint.isValidContext(evaluator)) {
    return null;
  }
  String funName=fun.getName();
  if (!"String_Node_Str".equalsIgnoreCase(funName)) {
    return null;
  }
  if (args.length != 2) {
    return null;
  }
  CrossJoinArg[] cargs=checkCrossJoinArg(evaluator,args[0]);
  if (cargs == null) {
    return null;
  }
  if (isPreferInterpreter(cargs,false)) {
    return null;
  }
  SchemaReader schemaReader=evaluator.getSchemaReader();
  DataSource ds=schemaReader.getDataSource();
  SqlQuery sqlQuery=SqlQuery.newQuery(ds,"String_Node_Str");
  RolapNativeSql sql=new RolapNativeSql(sqlQuery);
  String filterExpr=sql.generateFilterCondition(args[1]);
  if (filterExpr == null) {
    return null;
  }
  if (SqlConstraintUtils.containsCalculatedMember(evaluator.getMembers())) {
    return null;
  }
  LOGGER.debug("String_Node_Str");
  evaluator=overrideContext(evaluator,cargs,sql.getStoredMeasure());
  TupleConstraint constraint=new FilterConstraint(cargs,evaluator,filterExpr);
  return new SetEvaluator(cargs,schemaReader,constraint);
}
Program: 51288
Project: 51288
Buggy source:
public Type getResultType(Validator validator,Exp[] args){
  if (args.length == 1) {
    Hierarchy hierarchy=validator.getQuery().getCube().getTimeDimension().getHierarchy();
    return new SetType(MemberType.forHierarchy(hierarchy));
  }
 else {
    Type type=args[1].getType();
    Type memberType=TypeUtil.toMemberOrTupleType(type);
    return new SetType(memberType);
  }
}

Fixed version (ground truth):
public Type getResultType(Validator validator,Exp[] args){
  if (args.length == 1) {
    Dimension defaultTimeDimension=validator.getQuery().getCube().getTimeDimension();
    if (defaultTimeDimension == null) {
      throw MondrianResource.instance().NoTimeDimensionInCube.ex(getName());
    }
    Hierarchy hierarchy=defaultTimeDimension.getHierarchy();
    return new SetType(MemberType.forHierarchy(hierarchy));
  }
 else {
    Type type=args[1].getType();
    Type memberType=TypeUtil.toMemberOrTupleType(type);
    return new SetType(memberType);
  }
}