Program: 95979
Project: 95979
Buggy source:
SelectQuery composeQuery(Map<String,Object> metaData){
  List<UnnamedColumn> tierPredicates=method.getTierExpressions(metaData);
  int tierCount=tierPredicates.size() + 1;
  String tierColumnName=options.get("String_Node_Str");
  String blockColumnName=options.get("String_Node_Str");
  List<SelectItem> selectItems=new ArrayList<>();
  selectItems.add(new AsteriskColumn());
  List<UnnamedColumn> tierOperands=new ArrayList<>();
  UnnamedColumn tierExpr=null;
  if (tierPredicates.size() == 0) {
    tierExpr=ConstantColumn.valueOf(0);
  }
 else   if (tierPredicates.size() > 0) {
    for (int i=0; i < tierPredicates.size(); i++) {
      UnnamedColumn pred=tierPredicates.get(i);
      tierOperands.add(pred);
      tierOperands.add(ConstantColumn.valueOf(i));
    }
    tierOperands.add(ConstantColumn.valueOf(tierPredicates.size()));
    tierExpr=ColumnOp.whenthenelse(tierOperands);
  }
  selectItems.add(new AliasedColumn(tierExpr,tierColumnName));
  UnnamedColumn blockExpr=null;
  List<UnnamedColumn> blockOperands=new ArrayList<>();
  for (int i=0; i < tierCount; i++) {
    List<Double> cumulProb=method.getCumulativeProbabilityDistributionForTier(metaData,i);
    List<Double> condProb=computeConditionalProbabilityDistribution(cumulProb);
    int blockCount=cumulProb.size();
    List<UnnamedColumn> blockForTierOperands=new ArrayList<>();
    for (int j=0; j < blockCount; j++) {
      blockForTierOperands.add(ColumnOp.lessequal(ColumnOp.rand(),ConstantColumn.valueOf(condProb.get(j))));
      blockForTierOperands.add(ConstantColumn.valueOf(j));
    }
    UnnamedColumn blockForTierExpr;
    ;
    if (blockForTierOperands.size() <= 1) {
      blockForTierExpr=ConstantColumn.valueOf(0);
    }
 else {
      blockForTierExpr=ColumnOp.whenthenelse(blockForTierOperands);
    }
    if (i < tierCount - 1) {
      blockOperands.add(ColumnOp.equal(tierExpr,ConstantColumn.valueOf(i)));
    }
    blockOperands.add(blockForTierExpr);
  }
  if (tierCount == 1) {
    blockExpr=blockOperands.get(0);
  }
 else {
    blockExpr=ColumnOp.whenthenelse(blockOperands);
  }
  selectItems.add(new AliasedColumn(blockExpr,blockColumnName));
  AbstractRelation tableSource=method.getScramblingSource(originalSchemaName,originalTableName,metaData);
  SelectQuery scramblingQuery=SelectQuery.create(selectItems,tableSource);
  return scramblingQuery;
}

Fixed version (ground truth):
SelectQuery composeQuery(Map<String,Object> metaData){
  List<UnnamedColumn> tierPredicates=method.getTierExpressions(metaData);
  int tierCount=tierPredicates.size() + 1;
  String tierColumnName=options.get("String_Node_Str");
  String blockColumnName=options.get("String_Node_Str");
  List<SelectItem> selectItems=new ArrayList<>();
  @SuppressWarnings("String_Node_Str") List<Pair<String,String>> columnNamesAndTypes=(List<Pair<String,String>>)metaData.get(ScramblingPlan.COLUMN_METADATA_KEY);
  final String mainTableAlias=method.getMainTableAlias();
  for (  Pair<String,String> nameAndType : columnNamesAndTypes) {
    String name=nameAndType.getLeft();
    selectItems.add(new BaseColumn(mainTableAlias,name));
  }
  List<UnnamedColumn> tierOperands=new ArrayList<>();
  UnnamedColumn tierExpr=null;
  if (tierPredicates.size() == 0) {
    tierExpr=ConstantColumn.valueOf(0);
  }
 else   if (tierPredicates.size() > 0) {
    for (int i=0; i < tierPredicates.size(); i++) {
      UnnamedColumn pred=tierPredicates.get(i);
      tierOperands.add(pred);
      tierOperands.add(ConstantColumn.valueOf(i));
    }
    tierOperands.add(ConstantColumn.valueOf(tierPredicates.size()));
    tierExpr=ColumnOp.whenthenelse(tierOperands);
  }
  selectItems.add(new AliasedColumn(tierExpr,tierColumnName));
  UnnamedColumn blockExpr=null;
  List<UnnamedColumn> blockOperands=new ArrayList<>();
  for (int i=0; i < tierCount; i++) {
    List<Double> cumulProb=method.getCumulativeProbabilityDistributionForTier(metaData,i);
    List<Double> condProb=computeConditionalProbabilityDistribution(cumulProb);
    int blockCount=cumulProb.size();
    List<UnnamedColumn> blockForTierOperands=new ArrayList<>();
    for (int j=0; j < blockCount; j++) {
      blockForTierOperands.add(ColumnOp.lessequal(ColumnOp.rand(),ConstantColumn.valueOf(condProb.get(j))));
      blockForTierOperands.add(ConstantColumn.valueOf(j));
    }
    UnnamedColumn blockForTierExpr;
    ;
    if (blockForTierOperands.size() <= 1) {
      blockForTierExpr=ConstantColumn.valueOf(0);
    }
 else {
      blockForTierExpr=ColumnOp.whenthenelse(blockForTierOperands);
    }
    if (i < tierCount - 1) {
      blockOperands.add(ColumnOp.equal(tierExpr,ConstantColumn.valueOf(i)));
    }
    blockOperands.add(blockForTierExpr);
  }
  if (tierCount == 1) {
    blockExpr=blockOperands.get(0);
  }
 else {
    blockExpr=ColumnOp.whenthenelse(blockOperands);
  }
  selectItems.add(new AliasedColumn(blockExpr,blockColumnName));
  AbstractRelation tableSource=method.getScramblingSource(originalSchemaName,originalTableName,metaData);
  SelectQuery scramblingQuery=SelectQuery.create(selectItems,tableSource);
  return scramblingQuery;
}