Program: 65630
Project: 65630
Buggy source:
public int getFilterType(IFilterDefinition filter,Set<DimLevel> dimLevelInCubeQuery) throws DataException {
  if (!(filter instanceof ICubeFilterDefinition)) {
    if (filter.getExpression() instanceof ICollectionConditionalExpression) {
      Collection<IScriptExpression> exprs=((ICollectionConditionalExpression)(filter.getExpression())).getExpr();
      Set dimensionSet=new HashSet();
      Iterator<IScriptExpression> exprsIterator=exprs.iterator();
      while (exprsIterator.hasNext()) {
        Iterator dimLevels=OlapExpressionCompiler.getReferencedDimLevel(exprsIterator.next(),this.defn.getBindings()).iterator();
        while (dimLevels.hasNext())         dimensionSet.add(((DimLevel)dimLevels.next()).getDimensionName());
      }
      if (dimensionSet.size() == 1 && filter.updateAggregation())       return CubeQueryExecutor.DIMENSION_FILTER;
 else       return CubeQueryExecutor.FACTTABLE_FILTER;
    }
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
  ICubeFilterDefinition cubeFilter=(ICubeFilterDefinition)filter;
  if (cubeFilter.getTargetLevel() != null) {
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
 else {
    String measure=OlapExpressionCompiler.getReferencedScriptObject(filter.getExpression(),ScriptConstants.MEASURE_SCRIPTABLE);
    if (measure != null)     return CubeQueryExecutor.FACTTABLE_FILTER;
    List bindingName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
    if (bindingName.size() > 0) {
      if (existAggregationBinding(bindingName,this.defn.getBindings()))       return CubeQueryExecutor.AGGR_MEASURE_FILTER;
      Set targetDimLevel=OlapExpressionCompiler.getReferencedDimLevel(filter.getExpression(),this.defn.getBindings());
      if (!targetDimLevel.isEmpty() && targetDimLevel.size() == 1) {
        return CubeQueryExecutor.DIMENSION_FILTER;
      }
      List derivedBindingNameList=new ArrayList();
      for (int i=0; i < bindingName.size(); i++) {
        IBinding binding=getBinding(bindingName.get(i).toString(),this.defn.getBindings());
        if (binding != null) {
          List temp=ExpressionCompilerUtil.extractColumnExpression(binding.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
          if (temp != null && temp.size() > 0)           derivedBindingNameList.addAll(temp);
        }
      }
      if (derivedBindingNameList.size() > 0) {
        if (existAggregationBinding(derivedBindingNameList,this.defn.getBindings()))         return CubeQueryExecutor.AGGR_MEASURE_FILTER;
      }
      return CubeQueryExecutor.FACTTABLE_FILTER;
    }
 else {
      List dimensionName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DIMENSION_SCRIPTABLE);
      if (dimensionName.size() > 1) {
        return FACTTABLE_FILTER;
      }
      return DIMENSION_FILTER;
    }
  }
}

Fixed version (ground truth):
public int getFilterType(IFilterDefinition filter,Set<DimLevel> dimLevelInCubeQuery) throws DataException {
  if (!(filter instanceof ICubeFilterDefinition)) {
    if (filter.getExpression() instanceof ICollectionConditionalExpression) {
      Collection<IScriptExpression> exprs=((ICollectionConditionalExpression)(filter.getExpression())).getExpr();
      Set dimensionSet=new HashSet();
      Iterator<IScriptExpression> exprsIterator=exprs.iterator();
      while (exprsIterator.hasNext()) {
        Iterator dimLevels=OlapExpressionCompiler.getReferencedDimLevel(exprsIterator.next(),this.defn.getBindings()).iterator();
        while (dimLevels.hasNext())         dimensionSet.add(((DimLevel)dimLevels.next()).getDimensionName());
      }
      if (dimensionSet.size() == 1 && filter.updateAggregation())       return CubeQueryExecutor.DIMENSION_FILTER;
 else       return CubeQueryExecutor.FACTTABLE_FILTER;
    }
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
  ICubeFilterDefinition cubeFilter=(ICubeFilterDefinition)filter;
  if (cubeFilter.getTargetLevel() != null) {
    return CubeQueryExecutor.DIMENSION_FILTER;
  }
 else {
    String measure=OlapExpressionCompiler.getReferencedScriptObject(filter.getExpression(),ScriptConstants.MEASURE_SCRIPTABLE);
    if (measure != null)     return CubeQueryExecutor.FACTTABLE_FILTER;
    List bindingName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
    if (bindingName.size() > 0) {
      List bindingList=new ArrayList();
      bindingList.addAll(this.defn.getBindings());
      if (this.defn instanceof PreparedCubeQueryDefinition)       bindingList.addAll(((PreparedCubeQueryDefinition)this.defn).getBindingsForNestAggregation());
      if (existAggregationBinding(bindingName,bindingList))       return CubeQueryExecutor.AGGR_MEASURE_FILTER;
      Set targetDimLevel=OlapExpressionCompiler.getReferencedDimLevel(filter.getExpression(),this.defn.getBindings());
      if (!targetDimLevel.isEmpty() && targetDimLevel.size() == 1) {
        return CubeQueryExecutor.DIMENSION_FILTER;
      }
      List derivedBindingNameList=new ArrayList();
      for (int i=0; i < bindingName.size(); i++) {
        IBinding binding=getBinding(bindingName.get(i).toString(),this.defn.getBindings());
        if (binding != null) {
          List temp=ExpressionCompilerUtil.extractColumnExpression(binding.getExpression(),ScriptConstants.DATA_BINDING_SCRIPTABLE);
          if (temp != null && temp.size() > 0)           derivedBindingNameList.addAll(temp);
        }
      }
      if (derivedBindingNameList.size() > 0) {
        if (existAggregationBinding(derivedBindingNameList,this.defn.getBindings()))         return CubeQueryExecutor.AGGR_MEASURE_FILTER;
      }
      return CubeQueryExecutor.FACTTABLE_FILTER;
    }
 else {
      List dimensionName=ExpressionCompilerUtil.extractColumnExpression(filter.getExpression(),ScriptConstants.DIMENSION_SCRIPTABLE);
      if (dimensionName.size() > 1) {
        return FACTTABLE_FILTER;
      }
      return DIMENSION_FILTER;
    }
  }
}