nus-yam/ex-repair huggingface dataset:
Program: 63258
Project: 63258
Buggy source:
@BeforeClass public static void beforeClass() throws Exception {
  FileUtils.forceMkdir(new File(KylinConfig.getInstanceFromEnv().getKylinJobLogDir()));
  FileUtils.deleteDirectory(new File(tempTestMetadataUrl));
  FileUtils.copyDirectory(new File(AbstractKylinTestCase.LOCALMETA_TEST_DATA),new File(tempTestMetadataUrl));
  System.setProperty(KylinConfig.KYLIN_CONF,tempTestMetadataUrl);
  SSHClient hadoopCli=new SSHClient(getHadoopCliHostname(),getHadoopCliUsername(),getHadoopCliPassword(),null);
  scpFilesToHdfs(hadoopCli,new String[]{"String_Node_Str"},mrInputDir);
  hadoopCli.scpFileToRemote("String_Node_Str","String_Node_Str");
  hadoopCli.scpFileToRemote("String_Node_Str","String_Node_Str");
  hadoopCli.execCommand("String_Node_Str" + KylinConfig.getInstanceFromEnv().getKylinJobLogDir());
  KylinConfig kylinConfig=KylinConfig.getInstanceFromEnv();
  kylinConfig.setMetadataUrl(tempTestMetadataUrl);
  jobManager=new JobManager("String_Node_Str",new JobEngineConfig(KylinConfig.getInstanceFromEnv()));
  jobDAO=JobDAO.getInstance(KylinConfig.getInstanceFromEnv());
  jobDAO.updateJobInstance(createARunningJobInstance("String_Node_Str"));
  jobManager.startJobEngine(2);
  Thread.sleep(2000);
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws Exception {
  FileUtils.forceMkdir(new File(KylinConfig.getInstanceFromEnv().getKylinJobLogDir()));
  FileUtils.deleteDirectory(new File(tempTestMetadataUrl));
  FileUtils.copyDirectory(new File(AbstractKylinTestCase.LOCALMETA_TEST_DATA),new File(tempTestMetadataUrl));
  System.setProperty(KylinConfig.KYLIN_CONF,tempTestMetadataUrl);
  SSHClient hadoopCli=new SSHClient(getHadoopCliHostname(),getHadoopCliUsername(),getHadoopCliPassword());
  scpFilesToHdfs(hadoopCli,new String[]{"String_Node_Str"},mrInputDir);
  hadoopCli.scpFileToRemote("String_Node_Str","String_Node_Str");
  hadoopCli.scpFileToRemote("String_Node_Str","String_Node_Str");
  hadoopCli.execCommand("String_Node_Str" + KylinConfig.getInstanceFromEnv().getKylinJobLogDir());
  KylinConfig kylinConfig=KylinConfig.getInstanceFromEnv();
  kylinConfig.setMetadataUrl(tempTestMetadataUrl);
  jobManager=new JobManager("String_Node_Str",new JobEngineConfig(KylinConfig.getInstanceFromEnv()));
  jobDAO=JobDAO.getInstance(KylinConfig.getInstanceFromEnv());
  jobDAO.updateJobInstance(createARunningJobInstance("String_Node_Str"));
  jobManager.startJobEngine(2);
  Thread.sleep(2000);
}
Program: 63260
Project: 63260
Buggy source:
public void init(Map<String,Map<String,TblColRef>> columnMap){
  if (null != partitionDateColumn) {
    String[] columns=partitionDateColumn.split("String_Node_Str");
    if (null != columns && columns.length == 2) {
      Map<String,TblColRef> cols=columnMap.get(columns[0].toUpperCase());
      if (cols != null)       partitionDateColumnRef=cols.get(columns[1].toUpperCase());
    }
  }
}

Fixed version (ground truth):
public void init(Map<String,Map<String,TblColRef>> columnMap){
  if (null != partitionDateColumn) {
    partitionDateColumn=partitionDateColumn.toUpperCase();
    String[] columns=StringSplitter.split(partitionDateColumn,"String_Node_Str");
    if (null != columns && columns.length == 3) {
      Map<String,TblColRef> cols=columnMap.get(columns[0].toUpperCase() + "String_Node_Str" + columns[1].toUpperCase());
      if (cols != null)       partitionDateColumnRef=cols.get(columns[2].toUpperCase());
    }
  }
}
Program: 63262
Project: 63262
Buggy source:
/** 
 * @deprecated use getTableDesc() to get accurate table info
 * @return
 */
public String getTable(){
  if (database == null) {
    return ("String_Node_Str" + table).toUpperCase();
  }
 else {
    return (database + "String_Node_Str" + table).toUpperCase();
  }
}

Fixed version (ground truth):
/** 
 * @return
 */
public String getTable(){
  if (database == null) {
    return ("String_Node_Str" + table).toUpperCase();
  }
 else {
    return (database + "String_Node_Str" + table).toUpperCase();
  }
}
Program: 63263
Project: 63263
Buggy source:
private void copyRemote(String localFile,String destDir) throws IOException {
  SSHClient ssh=new SSHClient(remoteHost,remoteUser,remotePwd,null);
  try {
    ssh.scpFileToRemote(localFile,destDir);
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IOException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
private void copyRemote(String localFile,String destDir) throws IOException {
  SSHClient ssh=new SSHClient(remoteHost,remoteUser,remotePwd);
  try {
    ssh.scpFileToRemote(localFile,destDir);
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IOException(e.getMessage(),e);
  }
}
Program: 63264
Project: 63264
Buggy source:
private Pair<Integer,String> runRemoteCommand(String command) throws IOException {
  SSHClient ssh=new SSHClient(remoteHost,remoteUser,remotePwd,null);
  SSHClientOutput sshOutput;
  try {
    sshOutput=ssh.execCommand(command,remoteTimeoutSeconds);
    int exitCode=sshOutput.getExitCode();
    String output=sshOutput.getText();
    return new Pair<Integer,String>(exitCode,output);
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IOException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
private Pair<Integer,String> runRemoteCommand(String command,Logger logAppender) throws IOException {
  SSHClient ssh=new SSHClient(remoteHost,remoteUser,remotePwd);
  SSHClientOutput sshOutput;
  try {
    sshOutput=ssh.execCommand(command,remoteTimeoutSeconds,logAppender);
    int exitCode=sshOutput.getExitCode();
    String output=sshOutput.getText();
    return new Pair<Integer,String>(exitCode,output);
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IOException(e.getMessage(),e);
  }
}
Program: 63265
Project: 63265
Buggy source:
private Pair<Integer,String> runNativeCommand(String command) throws IOException {
  String[] cmd=new String[3];
  String osName=System.getProperty("String_Node_Str");
  if (osName.startsWith("String_Node_Str")) {
    cmd[0]="String_Node_Str";
    cmd[1]="String_Node_Str";
  }
 else {
    cmd[0]="String_Node_Str";
    cmd[1]="String_Node_Str";
  }
  cmd[2]=command;
  ProcessBuilder builder=new ProcessBuilder(cmd);
  builder.redirectErrorStream(true);
  Process proc=builder.start();
  ByteArrayOutputStream buf=new ByteArrayOutputStream();
  IOUtils.copy(proc.getInputStream(),buf);
  String output=buf.toString("String_Node_Str");
  try {
    int exitCode=proc.waitFor();
    return new Pair<Integer,String>(exitCode,output);
  }
 catch (  InterruptedException e) {
    throw new IOException(e);
  }
}

Fixed version (ground truth):
private Pair<Integer,String> runNativeCommand(String command,Logger logAppender) throws IOException {
  String[] cmd=new String[3];
  String osName=System.getProperty("String_Node_Str");
  if (osName.startsWith("String_Node_Str")) {
    cmd[0]="String_Node_Str";
    cmd[1]="String_Node_Str";
  }
 else {
    cmd[0]="String_Node_Str";
    cmd[1]="String_Node_Str";
  }
  cmd[2]=command;
  ProcessBuilder builder=new ProcessBuilder(cmd);
  builder.redirectErrorStream(true);
  Process proc=builder.start();
  BufferedReader reader=new BufferedReader(new InputStreamReader(proc.getInputStream()));
  String line;
  StringBuilder result=new StringBuilder();
  while ((line=reader.readLine()) != null) {
    result.append("String_Node_Str").append('\n');
    if (logAppender != null) {
      logAppender.log(line);
    }
  }
  try {
    int exitCode=proc.waitFor();
    return new Pair<Integer,String>(exitCode,result.toString());
  }
 catch (  InterruptedException e) {
    throw new IOException(e);
  }
}
Program: 63266
Project: 63266
Buggy source:
public Pair<Integer,String> execute(String command) throws IOException {
  Pair<Integer,String> r;
  if (remoteHost == null) {
    r=runNativeCommand(command);
  }
 else {
    r=runRemoteCommand(command);
  }
  if (r.getFirst() != 0) {
    throw new IOException("String_Node_Str" + r.getFirst() + "String_Node_Str"+ command+ "String_Node_Str"+ r.getSecond());
  }
  return r;
}

Fixed version (ground truth):
public Pair<Integer,String> execute(String command,Logger logAppender) throws IOException {
  Pair<Integer,String> r;
  if (remoteHost == null) {
    r=runNativeCommand(command,logAppender);
  }
 else {
    r=runRemoteCommand(command,logAppender);
  }
  if (r.getFirst() != 0) {
    throw new IOException("String_Node_Str" + r.getFirst() + "String_Node_Str"+ command+ "String_Node_Str"+ r.getSecond());
  }
  return r;
}
Program: 63268
Project: 63268
Buggy source:
public SSHClient(String hostname,String username,String password,SSHLogger sshLogger){
  this.hostname=hostname;
  this.username=username;
  if (new File(password).exists()) {
    this.identityPath=new File(password).getAbsolutePath();
    this.password=null;
  }
 else {
    this.password=password;
    this.identityPath=null;
  }
  this.sshLogger=sshLogger;
}

Fixed version (ground truth):
public SSHClient(String hostname,String username,String password){
  this.hostname=hostname;
  this.username=username;
  if (new File(password).exists()) {
    this.identityPath=new File(password).getAbsolutePath();
    this.password=null;
  }
 else {
    this.password=password;
    this.identityPath=null;
  }
}
Program: 63269
Project: 63269
Buggy source:
@Test public void testScp() throws Exception {
  if (isRemote == false)   return;
  SSHClient ssh=new SSHClient(this.hostname,this.username,this.password,null);
  File tmpFile=FileUtil.createLocalTempFile(new File("String_Node_Str"),"String_Node_Str",false);
  ssh.scpFileToRemote(tmpFile.getAbsolutePath(),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testScp() throws Exception {
  if (isRemote == false)   return;
  SSHClient ssh=new SSHClient(this.hostname,this.username,this.password);
  File tmpFile=FileUtil.createLocalTempFile(new File("String_Node_Str"),"String_Node_Str",false);
  ssh.scpFileToRemote(tmpFile.getAbsolutePath(),"String_Node_Str");
}
Program: 63270
Project: 63270
Buggy source:
@Test public void testCmd() throws Exception {
  if (isRemote == false)   return;
  SSHClient ssh=new SSHClient(this.hostname,this.username,this.password,null);
  SSHClientOutput output=ssh.execCommand("String_Node_Str");
  assertEquals(0,output.getExitCode());
  assertEquals("String_Node_Str",output.getText());
}

Fixed version (ground truth):
@Test public void testCmd() throws Exception {
  if (isRemote == false)   return;
  SSHClient ssh=new SSHClient(this.hostname,this.username,this.password);
  SSHClientOutput output=ssh.execCommand("String_Node_Str");
  assertEquals(0,output.getExitCode());
  assertEquals("String_Node_Str",output.getText());
}
Program: 63271
Project: 63271
Buggy source:
protected int executeCommand(String command) throws JobException, IOException {
  output.reset();
  output.setStatus(JobStepStatusEnum.RUNNING);
  return cliCommandExecutor.execute(command).getFirst();
}

Fixed version (ground truth):
protected int executeCommand(String command) throws JobException, IOException {
  output.reset();
  output.setStatus(JobStepStatusEnum.RUNNING);
  return cliCommandExecutor.execute(command,output).getFirst();
}
Program: 63272
Project: 63272
Buggy source:
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public CubeDesc updateCubeAndDesc(CubeInstance cube,CubeDesc desc,String newProjectName) throws Exception {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str");
    }
  }
  if (!cube.getDescriptor().calculateSignature().equals(cube.getDescriptor().getSignature())) {
    this.releaseAllSegments(cube);
  }
  CubeDesc updatedCubeDesc=getMetadataManager().updateCubeDesc(desc);
  int cuboidCount=CuboidCLI.simulateCuboidGeneration(updatedCubeDesc);
  logger.info("String_Node_Str" + cube.getName() + "String_Node_Str"+ cuboidCount+ "String_Node_Str");
  if (!getProjectManager().isCubeInProject(newProjectName,cube)) {
    String owner=SecurityContextHolder.getContext().getAuthentication().getName();
    ProjectInstance newProject=getProjectManager().updateCubeToProject(cube.getName(),newProjectName,owner);
    accessService.inherit(cube,newProject);
  }
  return updatedCubeDesc;
}

Fixed version (ground truth):
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public CubeDesc updateCubeAndDesc(CubeInstance cube,CubeDesc desc,String newProjectName) throws Exception {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str");
    }
  }
  if (!cube.getDescriptor().calculateSignature().equals(cube.getDescriptor().getSignature())) {
    this.releaseAllSegments(cube);
  }
  CubeDesc updatedCubeDesc=getMetadataManager().updateCubeDesc(desc);
  if (updatedCubeDesc.getError().size() > 0)   return updatedCubeDesc;
  int cuboidCount=CuboidCLI.simulateCuboidGeneration(updatedCubeDesc);
  logger.info("String_Node_Str" + cube.getName() + "String_Node_Str"+ cuboidCount+ "String_Node_Str");
  if (!getProjectManager().isCubeInProject(newProjectName,cube)) {
    String owner=SecurityContextHolder.getContext().getAuthentication().getName();
    ProjectInstance newProject=getProjectManager().updateCubeToProject(cube.getName(),newProjectName,owner);
    accessService.inherit(cube,newProject);
  }
  return updatedCubeDesc;
}
Program: 63273
Project: 63273
Buggy source:
/** 
 * Get available table list of the input database
 * @return Table metadata array
 * @throws JsonProcessingException 
 * @throws IOException
 */
@RequestMapping(value="String_Node_Str",method={RequestMethod.PUT}) @ResponseBody @Metered(name="String_Node_Str") public CubeRequest updateCubeDesc(@RequestBody CubeRequest cubeRequest) throws JsonProcessingException {
  CubeDesc desc=deserializeCubeDesc(cubeRequest);
  if (desc == null) {
    return cubeRequest;
  }
  if (!cubeService.isCubeDescEditable(desc)) {
    String error="String_Node_Str" + desc.getName().toUpperCase() + "String_Node_Str";
    updateRequest(cubeRequest,false,error);
    return cubeRequest;
  }
  try {
    CubeInstance cube=cubeService.getCubeManager().getCube(cubeRequest.getCubeName());
    String projectName=(null == cubeRequest.getProject()) ? ProjectInstance.DEFAULT_PROJECT_NAME : cubeRequest.getProject();
    desc=cubeService.updateCubeAndDesc(cube,desc,projectName);
  }
 catch (  AccessDeniedException accessDeniedException) {
    throw new ForbiddenException("String_Node_Str");
  }
catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw new InternalErrorException("String_Node_Str",e);
  }
  if (desc.getError().isEmpty()) {
    cubeRequest.setSuccessful(true);
  }
 else {
    updateRequest(cubeRequest,false,omitMessage(desc.getError()));
  }
  String descData=JsonUtil.writeValueAsIndentString(desc);
  cubeRequest.setCubeDescData(descData);
  return cubeRequest;
}

Fixed version (ground truth):
/** 
 * Get available table list of the input database
 * @return Table metadata array
 * @throws JsonProcessingException 
 * @throws IOException
 */
@RequestMapping(value="String_Node_Str",method={RequestMethod.PUT}) @ResponseBody @Metered(name="String_Node_Str") public CubeRequest updateCubeDesc(@RequestBody CubeRequest cubeRequest) throws JsonProcessingException {
  CubeDesc desc=deserializeCubeDesc(cubeRequest);
  if (desc == null) {
    return cubeRequest;
  }
  if (!cubeService.isCubeDescEditable(desc)) {
    String error="String_Node_Str" + desc.getName().toUpperCase() + "String_Node_Str";
    updateRequest(cubeRequest,false,error);
    return cubeRequest;
  }
  try {
    CubeInstance cube=cubeService.getCubeManager().getCube(cubeRequest.getCubeName());
    String projectName=(null == cubeRequest.getProject()) ? ProjectInstance.DEFAULT_PROJECT_NAME : cubeRequest.getProject();
    desc=cubeService.updateCubeAndDesc(cube,desc,projectName);
  }
 catch (  AccessDeniedException accessDeniedException) {
    throw new ForbiddenException("String_Node_Str");
  }
catch (  Exception e) {
    throw new InternalErrorException("String_Node_Str",e);
  }
  if (desc.getError().isEmpty()) {
    cubeRequest.setSuccessful(true);
  }
 else {
    logger.warn("String_Node_Str" + desc.getName() + "String_Node_Str"+ desc.getError());
    updateRequest(cubeRequest,false,omitMessage(desc.getError()));
  }
  String descData=JsonUtil.writeValueAsIndentString(desc);
  cubeRequest.setCubeDescData(descData);
  return cubeRequest;
}
Program: 63274
Project: 63274
Buggy source:
/** 
 * Get available table list of the input database
 * @return Table metadata array
 * @throws IOException
 */
@RequestMapping(value="String_Node_Str",method={RequestMethod.PUT}) @ResponseBody @Metered(name="String_Node_Str") public CubeRequest updateCubeDesc(@RequestBody CubeRequest cubeRequest){
  CubeDesc desc=deserializeCubeDesc(cubeRequest);
  if (desc == null) {
    return cubeRequest;
  }
  if (!cubeService.isCubeDescEditable(desc)) {
    String error="String_Node_Str" + desc.getName().toUpperCase() + "String_Node_Str";
    updateRequest(cubeRequest,false,error);
    return cubeRequest;
  }
  String descData="String_Node_Str";
  try {
    CubeInstance cube=cubeService.getCubeManager().getCube(cubeRequest.getCubeName());
    String projectName=(null == cubeRequest.getProject()) ? ProjectInstance.DEFAULT_PROJECT_NAME : cubeRequest.getProject();
    desc=cubeService.updateCubeAndDesc(cube,desc,projectName);
    descData=JsonUtil.writeValueAsIndentString(desc);
  }
 catch (  AccessDeniedException accessDeniedException) {
    throw new ForbiddenException("String_Node_Str");
  }
catch (  Exception e) {
    logger.error("String_Node_Str",e);
    e.printStackTrace();
    throw new InternalErrorException("String_Node_Str",e);
  }
  if (desc.getError().isEmpty()) {
    cubeRequest.setSuccessful(true);
  }
 else {
    updateRequest(cubeRequest,false,omitMessage(desc.getError()));
  }
  cubeRequest.setCubeDescData(descData);
  return cubeRequest;
}

Fixed version (ground truth):
/** 
 * Get available table list of the input database
 * @return Table metadata array
 * @throws JsonProcessingException 
 * @throws IOException
 */
@RequestMapping(value="String_Node_Str",method={RequestMethod.PUT}) @ResponseBody @Metered(name="String_Node_Str") public CubeRequest updateCubeDesc(@RequestBody CubeRequest cubeRequest) throws JsonProcessingException {
  CubeDesc desc=deserializeCubeDesc(cubeRequest);
  if (desc == null) {
    return cubeRequest;
  }
  if (!cubeService.isCubeDescEditable(desc)) {
    String error="String_Node_Str" + desc.getName().toUpperCase() + "String_Node_Str";
    updateRequest(cubeRequest,false,error);
    return cubeRequest;
  }
  try {
    CubeInstance cube=cubeService.getCubeManager().getCube(cubeRequest.getCubeName());
    String projectName=(null == cubeRequest.getProject()) ? ProjectInstance.DEFAULT_PROJECT_NAME : cubeRequest.getProject();
    desc=cubeService.updateCubeAndDesc(cube,desc,projectName);
  }
 catch (  AccessDeniedException accessDeniedException) {
    throw new ForbiddenException("String_Node_Str");
  }
catch (  Exception e) {
    logger.error("String_Node_Str",e);
    throw new InternalErrorException("String_Node_Str",e);
  }
  if (desc.getError().isEmpty()) {
    cubeRequest.setSuccessful(true);
  }
 else {
    updateRequest(cubeRequest,false,omitMessage(desc.getError()));
  }
  String descData=JsonUtil.writeValueAsIndentString(desc);
  cubeRequest.setCubeDescData(descData);
  return cubeRequest;
}
Program: 63275
Project: 63275
Buggy source:
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public CubeDesc updateCubeAndDesc(CubeInstance cube,CubeDesc desc,String newProjectName) throws UnknownHostException, IOException, JobException {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str");
    }
  }
  try {
    if (!cube.getDescriptor().calculateSignature().equals(cube.getDescriptor().getSignature())) {
      this.releaseAllSegments(cube);
    }
    CubeDesc updatedCubeDesc=getMetadataManager().updateCubeDesc(desc);
    int cuboidCount=CuboidCLI.simulateCuboidGeneration(updatedCubeDesc);
    logger.info("String_Node_Str" + cube.getName() + "String_Node_Str"+ cuboidCount+ "String_Node_Str");
    if (!getProjectManager().isCubeInProject(newProjectName,cube)) {
      String owner=SecurityContextHolder.getContext().getAuthentication().getName();
      ProjectInstance newProject=getProjectManager().updateCubeToProject(cube.getName(),newProjectName,owner);
      accessService.inherit(cube,newProject);
    }
    return updatedCubeDesc;
  }
 catch (  IOException e) {
    throw new InternalErrorException("String_Node_Str",e);
  }
catch (  CubeIntegrityException e) {
    throw new InternalErrorException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public CubeDesc updateCubeAndDesc(CubeInstance cube,CubeDesc desc,String newProjectName) throws Exception {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str");
    }
  }
  if (!cube.getDescriptor().calculateSignature().equals(cube.getDescriptor().getSignature())) {
    this.releaseAllSegments(cube);
  }
  CubeDesc updatedCubeDesc=getMetadataManager().updateCubeDesc(desc);
  int cuboidCount=CuboidCLI.simulateCuboidGeneration(updatedCubeDesc);
  logger.info("String_Node_Str" + cube.getName() + "String_Node_Str"+ cuboidCount+ "String_Node_Str");
  if (!getProjectManager().isCubeInProject(newProjectName,cube)) {
    String owner=SecurityContextHolder.getContext().getAuthentication().getName();
    ProjectInstance newProject=getProjectManager().updateCubeToProject(cube.getName(),newProjectName,owner);
    accessService.inherit(cube,newProject);
  }
  return updatedCubeDesc;
}
Program: 63276
Project: 63276
Buggy source:
public static Set<String> reloadHiveTables(String[] hiveTables,KylinConfig config) throws IOException {
  Map<String,Set<String>> db2tables=Maps.newHashMap();
  for (  String table : hiveTables) {
    int cut=table.indexOf('.');
    String database=cut >= 0 ? table.substring(0,cut).trim() : "String_Node_Str";
    String tableName=cut >= 0 ? table.substring(cut + 1).trim() : table.trim();
    Set<String> set=db2tables.get(database);
    if (set == null) {
      set=Sets.newHashSet();
      db2tables.put(database,set);
    }
    set.add(tableName);
  }
  File metaTmpDir=File.createTempFile("String_Node_Str",null);
  metaTmpDir.delete();
  metaTmpDir.mkdirs();
  Set<String> loadedTables=Sets.newHashSet();
  for (  String database : db2tables.keySet()) {
    List<String> loaded=extractHiveTables(database,db2tables.get(database),metaTmpDir,config);
    loadedTables.addAll(loaded);
  }
  ResourceTool.copy(KylinConfig.createInstanceFromUri(metaTmpDir.getAbsolutePath()),config);
  return loadedTables;
}

Fixed version (ground truth):
public static Set<String> reloadHiveTables(String[] hiveTables,KylinConfig config) throws IOException {
  Map<String,Set<String>> db2tables=Maps.newHashMap();
  for (  String table : hiveTables) {
    int cut=table.indexOf('.');
    String database=cut >= 0 ? table.substring(0,cut).trim() : "String_Node_Str";
    String tableName=cut >= 0 ? table.substring(cut + 1).trim() : table.trim();
    Set<String> set=db2tables.get(database);
    if (set == null) {
      set=Sets.newHashSet();
      db2tables.put(database,set);
    }
    set.add(tableName);
  }
  File metaTmpDir=File.createTempFile("String_Node_Str",null);
  metaTmpDir.delete();
  metaTmpDir.mkdirs();
  for (  String database : db2tables.keySet()) {
    for (    String table : db2tables.get(database)) {
      TableDesc tableDesc=MetadataManager.getInstance(config).getTableDesc(table);
      if (tableDesc == null) {
        continue;
      }
      if (tableDesc.getDatabase().equalsIgnoreCase(database)) {
        continue;
      }
 else {
        throw new UnsupportedOperationException(String.format("String_Node_Str",tableDesc.getName(),tableDesc.getDatabase()));
      }
    }
  }
  Set<String> loadedTables=Sets.newHashSet();
  for (  String database : db2tables.keySet()) {
    List<String> loaded=extractHiveTables(database,db2tables.get(database),metaTmpDir,config);
    loadedTables.addAll(loaded);
  }
  ResourceTool.copy(KylinConfig.createInstanceFromUri(metaTmpDir.getAbsolutePath()),config);
  return loadedTables;
}
Program: 63277
Project: 63277
Buggy source:
@Override public void serialize(TableRecordInfoDigest value,ByteBuffer out){
  BytesUtil.writeVInt(value.nColumns,out);
  BytesUtil.writeVInt(value.byteFormLen,out);
  BytesUtil.writeIntArray(value.offsets,out);
  BytesUtil.writeIntArray(value.dictMaxIds,out);
  BytesUtil.writeIntArray(value.lengths,out);
  for (int i=0; i < value.measureSerializers.length; ++i) {
    BytesUtil.writeAsciiString(value.measureSerializers[i].getDataType().toString(),out);
  }
}

Fixed version (ground truth):
@Override public void serialize(TableRecordInfoDigest value,ByteBuffer out){
  BytesUtil.writeVInt(value.nColumns,out);
  BytesUtil.writeVInt(value.byteFormLen,out);
  BytesUtil.writeIntArray(value.offsets,out);
  BytesUtil.writeIntArray(value.dictMaxIds,out);
  BytesUtil.writeIntArray(value.lengths,out);
  for (int i=0; i < value.measureSerializers.length; ++i) {
    if (value.isMetrics(i)) {
      BytesUtil.writeAsciiString(value.measureSerializers[i].getDataType().toString(),out);
    }
 else {
      BytesUtil.writeAsciiString(null,out);
    }
  }
}
Program: 63278
Project: 63278
Buggy source:
public int getTablesCount(){
  return cubes.size();
}

Fixed version (ground truth):
public int getTablesCount(){
  return this.getTables().size();
}
Program: 63279
Project: 63279
Buggy source:
public static Set<String> reloadHiveTables(String[] hiveTables,KylinConfig config) throws IOException {
  Map<String,Set<String>> db2tables=Maps.newHashMap();
  for (  String table : hiveTables) {
    int cut=table.indexOf('.');
    String database=cut >= 0 ? table.substring(0,cut).trim() : "String_Node_Str";
    String tableName=cut >= 0 ? table.substring(cut + 1).trim() : table.trim();
    Set<String> set=db2tables.get(database);
    if (set == null) {
      set=Sets.newHashSet();
      db2tables.put(database,set);
    }
    set.add(tableName);
  }
  File metaTmpDir=File.createTempFile("String_Node_Str",null);
  metaTmpDir.delete();
  metaTmpDir.mkdirs();
  Set<String> loadedTables=Sets.newHashSet();
  for (  String database : db2tables.keySet()) {
    List<String> loaded=extractHiveTables(database,db2tables.get(database),metaTmpDir,config);
    loadedTables.addAll(loaded);
  }
  ResourceTool.copy(KylinConfig.createInstanceFromUri(metaTmpDir.getAbsolutePath()),config);
  return loadedTables;
}

Fixed version (ground truth):
public static Set<String> reloadHiveTables(String[] hiveTables,KylinConfig config) throws IOException {
  Map<String,Set<String>> db2tables=Maps.newHashMap();
  for (  String table : hiveTables) {
    int cut=table.indexOf('.');
    String database=cut >= 0 ? table.substring(0,cut).trim() : "String_Node_Str";
    String tableName=cut >= 0 ? table.substring(cut + 1).trim() : table.trim();
    Set<String> set=db2tables.get(database);
    if (set == null) {
      set=Sets.newHashSet();
      db2tables.put(database,set);
    }
    set.add(tableName);
  }
  File metaTmpDir=File.createTempFile("String_Node_Str",null);
  metaTmpDir.delete();
  metaTmpDir.mkdirs();
  for (  String database : db2tables.keySet()) {
    for (    String table : db2tables.get(database)) {
      TableDesc tableDesc=MetadataManager.getInstance(config).getTableDesc(table);
      if (tableDesc == null) {
        continue;
      }
      if (tableDesc.getDatabase().equalsIgnoreCase(database)) {
        continue;
      }
 else {
        throw new UnsupportedOperationException(String.format("String_Node_Str",tableDesc.getName(),tableDesc.getDatabase()));
      }
    }
  }
  Set<String> loadedTables=Sets.newHashSet();
  for (  String database : db2tables.keySet()) {
    List<String> loaded=extractHiveTables(database,db2tables.get(database),metaTmpDir,config);
    loadedTables.addAll(loaded);
  }
  ResourceTool.copy(KylinConfig.createInstanceFromUri(metaTmpDir.getAbsolutePath()),config);
  return loadedTables;
}
Program: 63280
Project: 63280
Buggy source:
/** 
 * make snapshots for the new segment by copying from one of the underlying merging segments. it's ganranteed to be consistent(checked in CubeSegmentValidator)
 * @param cube
 * @param newSeg
 */
private void makeSnapshotForNewSegment(CubeSegment newSeg,List<CubeSegment> mergingSegments){
  for (  Map.Entry<String,String> entry : mergingSegments.get(0).getSnapshots().entrySet()) {
    newSeg.putSnapshotResPath(entry.getKey(),entry.getValue());
  }
}

Fixed version (ground truth):
/** 
 * make snapshots for the new segment by copying from one of the underlying merging segments. it's ganranteed to be consistent(checked in CubeSegmentValidator)
 * @param cube
 * @param newSeg
 */
private void makeSnapshotForNewSegment(CubeInstance cube,CubeSegment newSeg){
  List<CubeSegment> mergingSegments=cube.getMergingSegments(newSeg);
  for (  Map.Entry<String,String> entry : mergingSegments.get(0).getSnapshots().entrySet()) {
    newSeg.putSnapshotResPath(entry.getKey(),entry.getValue());
  }
}
Program: 63284
Project: 63284
Buggy source:
private void checkContingency(CubeInstance cubeInstance,CubeSegment newSegment) throws CubeIntegrityException {
  CubeSegment startSeg=null;
  CubeSegment endSeg=null;
  for (  CubeSegment segment : cubeInstance.getSegments()) {
    if (segment.getDateRangeStart() == newSegment.getDateRangeStart()) {
      startSeg=segment;
    }
    if (segment.getDateRangeEnd() == newSegment.getDateRangeEnd()) {
      endSeg=segment;
    }
  }
  if (null == startSeg || null == endSeg || startSeg.getDateRangeStart() >= endSeg.getDateRangeStart()) {
    throw new CubeIntegrityException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void checkContingency(CubeInstance cubeInstance,List<CubeSegment> newSegments) throws CubeIntegrityException {
  if (cubeInstance.getSegments().size() < 2) {
    throw new CubeIntegrityException("String_Node_Str");
  }
  if (newSegments.size() != 1) {
    throw new CubeIntegrityException("String_Node_Str");
  }
  CubeSegment newSegment=newSegments.get(0);
  CubeSegment startSeg=null;
  CubeSegment endSeg=null;
  for (  CubeSegment segment : cubeInstance.getSegments()) {
    if (segment.getDateRangeStart() == newSegment.getDateRangeStart()) {
      startSeg=segment;
    }
    if (segment.getDateRangeEnd() == newSegment.getDateRangeEnd()) {
      endSeg=segment;
    }
  }
  if (null == startSeg || null == endSeg || startSeg.getDateRangeStart() >= endSeg.getDateRangeStart()) {
    throw new CubeIntegrityException("String_Node_Str");
  }
}
Program: 63287
Project: 63287
Buggy source:
private static void appendWhereStatement(JoinedFlatTableDesc intermediateTableDesc,StringBuilder sql){
  boolean hasCondition=false;
  StringBuilder whereBuilder=new StringBuilder();
  whereBuilder.append("String_Node_Str");
  CubeDesc cubeDesc=intermediateTableDesc.getCubeDesc();
  if (cubeDesc.getFilterCondition() != null && cubeDesc.getFilterCondition().equals("String_Node_Str") == false) {
    whereBuilder.append("String_Node_Str").append(cubeDesc.getFilterCondition()).append("String_Node_Str");
    hasCondition=true;
  }
  CubeSegment cubeSegment=intermediateTableDesc.getCubeSegment();
  if (null != cubeSegment) {
    long dateStart=cubeSegment.getDateRangeStart();
    long dateEnd=cubeSegment.getDateRangeEnd();
    if (!(dateStart == 0 && dateEnd == 0)) {
      String partitionColumnName=cubeDesc.getCubePartitionDesc().getPartitionDateColumn();
      whereBuilder.append(hasCondition ? "String_Node_Str" : "String_Node_Str");
      if (dateStart > 0) {
        whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateStart)+ "String_Node_Str");
        whereBuilder.append("String_Node_Str");
      }
      whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateEnd)+ "String_Node_Str");
      whereBuilder.append("String_Node_Str");
      hasCondition=true;
    }
  }
  if (hasCondition) {
    sql.append(whereBuilder.toString());
  }
}

Fixed version (ground truth):
private static void appendWhereStatement(JoinedFlatTableDesc intermediateTableDesc,StringBuilder sql){
  boolean hasCondition=false;
  StringBuilder whereBuilder=new StringBuilder();
  whereBuilder.append("String_Node_Str");
  CubeDesc cubeDesc=intermediateTableDesc.getCubeDesc();
  if (cubeDesc.getFilterCondition() != null && cubeDesc.getFilterCondition().equals("String_Node_Str") == false) {
    whereBuilder.append("String_Node_Str").append(cubeDesc.getFilterCondition()).append("String_Node_Str");
    hasCondition=true;
  }
  CubeSegment cubeSegment=intermediateTableDesc.getCubeSegment();
  if (null != cubeSegment) {
    long dateStart=cubeSegment.getDateRangeStart();
    long dateEnd=cubeSegment.getDateRangeEnd();
    if (cubeSegment.getCubeInstance().incrementalBuildOnHll()) {
      dateStart=cubeSegment.getCubeInstance().getDateRange()[1];
    }
    if (!(dateStart == 0 && dateEnd == 0)) {
      String partitionColumnName=cubeDesc.getCubePartitionDesc().getPartitionDateColumn();
      whereBuilder.append(hasCondition ? "String_Node_Str" : "String_Node_Str");
      if (dateStart > 0) {
        whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateStart)+ "String_Node_Str");
        whereBuilder.append("String_Node_Str");
      }
      whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateEnd)+ "String_Node_Str");
      whereBuilder.append("String_Node_Str");
      hasCondition=true;
    }
  }
  if (hasCondition) {
    sql.append(whereBuilder.toString());
  }
}
Program: 63289
Project: 63289
Buggy source:
protected List<String> submitJob(String cubename,long startDate,long endDate,CubeBuildTypeEnum jobType) throws SchedulerException, IOException, InvalidJobInstanceException, CubeIntegrityException {
  CubeManager cubeMgr=CubeManager.getInstance(KylinConfig.getInstanceFromEnv());
  CubeInstance cube=cubeMgr.getCube(cubename);
  CubeManager.getInstance(this.getTestConfig()).loadCubeCache(cube);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<CubeSegment> newSegments=cubeMgr.allocateSegments(cube,jobType,startDate,endDate);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<String> jobUuids=Lists.newArrayList();
  List<JobInstance> jobs=Lists.newArrayList();
  for (  CubeSegment seg : newSegments) {
    String uuid=seg.getUuid();
    jobUuids.add(uuid);
    jobs.add(jobManager.createJob(cubename,seg.getName(),uuid,jobType));
  }
  for (  JobInstance job : jobs) {
    jobManager.submitJob(job);
  }
  return jobUuids;
}

Fixed version (ground truth):
protected List<String> submitJob(String cubename,long startDate,long endDate,CubeBuildTypeEnum jobType) throws SchedulerException, IOException, InvalidJobInstanceException, CubeIntegrityException {
  CubeManager cubeMgr=CubeManager.getInstance(KylinConfig.getInstanceFromEnv());
  CubeInstance cube=cubeMgr.getCube(cubename);
  CubeManager.getInstance(this.getTestConfig()).loadCubeCache(cube);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<CubeSegment> newSegments=cubeMgr.allocateSegments(cube,jobType,startDate,endDate);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<String> jobUuids=Lists.newArrayList();
  List<JobInstance> jobs=Lists.newArrayList();
  for (  CubeSegment seg : newSegments) {
    String uuid=seg.getUuid();
    jobUuids.add(uuid);
    jobs.add(jobManager.createJob(cubename,seg.getName(),uuid,jobType));
    seg.setLastBuildJobID(uuid);
  }
  cubeMgr.updateCube(cube);
  for (  JobInstance job : jobs) {
    jobManager.submitJob(job);
  }
  return jobUuids;
}
Program: 63290
Project: 63290
Buggy source:
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public String submitJob(CubeInstance cube,long startDate,long endDate,CubeBuildTypeEnum buildType) throws IOException, JobException, InvalidJobInstanceException {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str" + cube.getName() + "String_Node_Str"+ jobInstance.getUuid()+ "String_Node_Str");
    }
  }
  String uuid=null;
  try {
    List<CubeSegment> cubeSegments=this.getCubeManager().allocateSegments(cube,buildType,startDate,endDate);
    List<JobInstance> jobs=Lists.newArrayListWithExpectedSize(cubeSegments.size());
    for (    CubeSegment segment : cubeSegments) {
      uuid=segment.getUuid();
      JobInstance job=this.getJobManager().createJob(cube.getName(),segment.getName(),segment.getUuid(),buildType);
      jobs.add(job);
    }
    for (    JobInstance job : jobs) {
      this.getJobManager().submitJob(job);
      permissionService.init(job,null);
      permissionService.inherit(job,cube);
    }
  }
 catch (  CubeIntegrityException e) {
    throw new InternalErrorException(e.getLocalizedMessage(),e);
  }
  return uuid;
}

Fixed version (ground truth):
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + "String_Node_Str") public String submitJob(CubeInstance cube,long startDate,long endDate,CubeBuildTypeEnum buildType) throws IOException, JobException, InvalidJobInstanceException {
  List<JobInstance> jobInstances=this.getJobManager().listJobs(cube.getName(),null);
  for (  JobInstance jobInstance : jobInstances) {
    if (jobInstance.getStatus() == JobStatusEnum.PENDING || jobInstance.getStatus() == JobStatusEnum.RUNNING) {
      throw new JobException("String_Node_Str" + cube.getName() + "String_Node_Str"+ jobInstance.getUuid()+ "String_Node_Str");
    }
  }
  String uuid=null;
  try {
    List<CubeSegment> cubeSegments=this.getCubeManager().allocateSegments(cube,buildType,startDate,endDate);
    List<JobInstance> jobs=Lists.newArrayListWithExpectedSize(cubeSegments.size());
    for (    CubeSegment segment : cubeSegments) {
      uuid=segment.getUuid();
      JobInstance job=this.getJobManager().createJob(cube.getName(),segment.getName(),segment.getUuid(),buildType);
      segment.setLastBuildJobID(uuid);
      jobs.add(job);
    }
    getCubeManager().updateCube(cube);
    for (    JobInstance job : jobs) {
      this.getJobManager().submitJob(job);
      permissionService.init(job,null);
      permissionService.inherit(job,cube);
    }
  }
 catch (  CubeIntegrityException e) {
    throw new InternalErrorException(e.getLocalizedMessage(),e);
  }
  return uuid;
}
Program: 63294
Project: 63294
Buggy source:
protected static void clean(){
  if (cubeConnection != null)   closeConnection(cubeConnection);
  if (h2Connection != null)   closeConnection(h2Connection);
  CoprocessorEnabler.forceCoprocessorUnset();
  HBaseMetadataTestCase.staticCleanupTestMetadata();
}

Fixed version (ground truth):
protected static void clean(){
  if (cubeConnection != null)   closeConnection(cubeConnection);
  if (h2Connection != null)   closeConnection(h2Connection);
  ObserverEnabler.forceCoprocessorUnset();
  HBaseMetadataTestCase.staticCleanupTestMetadata();
}
Program: 63295
Project: 63295
Buggy source:
public void updateSegmentOnJobSucceed(CubeInstance cubeInstance,CubeBuildTypeEnum buildType,String segmentName,String lastBuildJobUuid,long lastBuildTime,long sizeKB,long sourceRecordCount,long sourceRecordsSize) throws IOException, CubeIntegrityException {
  List<CubeSegment> segmentsInNewStatus=cubeInstance.getSegments(CubeSegmentStatusEnum.NEW);
  CubeSegment cubeSegment=cubeInstance.getSegment(segmentName,CubeSegmentStatusEnum.NEW);
switch (buildType) {
case BUILD:
    if (cubeInstance.incrementalBuildOnHll()) {
      cubeInstance.getSegments().removeAll(cubeInstance.getMergingSegments());
    }
 else {
      if (segmentsInNewStatus.size() == 1) {
        cubeInstance.getSegments().removeAll(cubeInstance.getRebuildingSegments());
      }
    }
  break;
case MERGE:
cubeInstance.getSegments().removeAll(cubeInstance.getMergingSegments());
break;
}
cubeSegment.setLastBuildJobID(lastBuildJobUuid);
cubeSegment.setLastBuildTime(lastBuildTime);
cubeSegment.setSizeKB(sizeKB);
cubeSegment.setSourceRecords(sourceRecordCount);
cubeSegment.setSourceRecordsSize(sourceRecordsSize);
if (segmentsInNewStatus.size() == 1) {
cubeSegment.setStatus(CubeSegmentStatusEnum.READY);
cubeInstance.setStatus(CubeStatusEnum.READY);
for (CubeSegment seg : cubeInstance.getSegments(CubeSegmentStatusEnum.READY_PENDING)) {
seg.setStatus(CubeSegmentStatusEnum.READY);
}
}
 else {
cubeSegment.setStatus(CubeSegmentStatusEnum.READY_PENDING);
}
this.updateCube(cubeInstance);
}

Fixed version (ground truth):
public void updateSegmentOnJobSucceed(CubeInstance cubeInstance,CubeBuildTypeEnum buildType,String segmentName,String lastBuildJobUuid,long lastBuildTime,long sizeKB,long sourceRecordCount,long sourceRecordsSize) throws IOException, CubeIntegrityException {
  List<CubeSegment> segmentsInNewStatus=cubeInstance.getSegments(CubeSegmentStatusEnum.NEW);
  CubeSegment cubeSegment=cubeInstance.getSegment(segmentName,CubeSegmentStatusEnum.NEW);
switch (buildType) {
case BUILD:
    if (cubeInstance.needMergeImmediately(cubeInstance.getSegmentById(lastBuildJobUuid))) {
      cubeInstance.getSegments().removeAll(cubeInstance.getMergingSegments());
    }
 else {
      if (segmentsInNewStatus.size() == 1) {
        cubeInstance.getSegments().removeAll(cubeInstance.getRebuildingSegments());
      }
    }
  break;
case MERGE:
cubeInstance.getSegments().removeAll(cubeInstance.getMergingSegments());
break;
}
cubeSegment.setLastBuildJobID(lastBuildJobUuid);
cubeSegment.setLastBuildTime(lastBuildTime);
cubeSegment.setSizeKB(sizeKB);
cubeSegment.setSourceRecords(sourceRecordCount);
cubeSegment.setSourceRecordsSize(sourceRecordsSize);
if (segmentsInNewStatus.size() == 1) {
cubeSegment.setStatus(CubeSegmentStatusEnum.READY);
cubeInstance.setStatus(CubeStatusEnum.READY);
for (CubeSegment seg : cubeInstance.getSegments(CubeSegmentStatusEnum.READY_PENDING)) {
seg.setStatus(CubeSegmentStatusEnum.READY);
}
}
 else {
cubeSegment.setStatus(CubeSegmentStatusEnum.READY_PENDING);
}
this.updateCube(cubeInstance);
}
Program: 63298
Project: 63298
Buggy source:
private static void appendWhereStatement(JoinedFlatTableDesc intermediateTableDesc,StringBuilder sql){
  boolean hasCondition=false;
  StringBuilder whereBuilder=new StringBuilder();
  whereBuilder.append("String_Node_Str");
  CubeDesc cubeDesc=intermediateTableDesc.getCubeDesc();
  if (cubeDesc.getFilterCondition() != null && cubeDesc.getFilterCondition().equals("String_Node_Str") == false) {
    whereBuilder.append("String_Node_Str").append(cubeDesc.getFilterCondition()).append("String_Node_Str");
    hasCondition=true;
  }
  CubeSegment cubeSegment=intermediateTableDesc.getCubeSegment();
  if (null != cubeSegment) {
    long dateStart=cubeSegment.getDateRangeStart();
    long dateEnd=cubeSegment.getDateRangeEnd();
    if (cubeSegment.getCubeInstance().incrementalBuildOnHll()) {
      dateStart=cubeSegment.getCubeInstance().getDateRange()[1];
    }
    if (!(dateStart == 0 && dateEnd == 0)) {
      String partitionColumnName=cubeDesc.getCubePartitionDesc().getPartitionDateColumn();
      whereBuilder.append(hasCondition ? "String_Node_Str" : "String_Node_Str");
      if (dateStart > 0) {
        whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateStart)+ "String_Node_Str");
        whereBuilder.append("String_Node_Str");
      }
      whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateEnd)+ "String_Node_Str");
      whereBuilder.append("String_Node_Str");
      hasCondition=true;
    }
  }
  if (hasCondition) {
    sql.append(whereBuilder.toString());
  }
}

Fixed version (ground truth):
private static void appendWhereStatement(JoinedFlatTableDesc intermediateTableDesc,StringBuilder sql){
  boolean hasCondition=false;
  StringBuilder whereBuilder=new StringBuilder();
  whereBuilder.append("String_Node_Str");
  CubeDesc cubeDesc=intermediateTableDesc.getCubeDesc();
  if (cubeDesc.getFilterCondition() != null && cubeDesc.getFilterCondition().equals("String_Node_Str") == false) {
    whereBuilder.append("String_Node_Str").append(cubeDesc.getFilterCondition()).append("String_Node_Str");
    hasCondition=true;
  }
  CubeSegment cubeSegment=intermediateTableDesc.getCubeSegment();
  if (null != cubeSegment) {
    long dateStart=cubeSegment.getDateRangeStart();
    long dateEnd=cubeSegment.getDateRangeEnd();
    if (!(dateStart == 0 && dateEnd == 0)) {
      String partitionColumnName=cubeDesc.getCubePartitionDesc().getPartitionDateColumn();
      whereBuilder.append(hasCondition ? "String_Node_Str" : "String_Node_Str");
      if (dateStart > 0) {
        whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateStart)+ "String_Node_Str");
        whereBuilder.append("String_Node_Str");
      }
      whereBuilder.append(partitionColumnName + "String_Node_Str" + formatDateTimeInWhereClause(dateEnd)+ "String_Node_Str");
      whereBuilder.append("String_Node_Str");
      hasCondition=true;
    }
  }
  if (hasCondition) {
    sql.append(whereBuilder.toString());
  }
}
Program: 63300
Project: 63300
Buggy source:
protected List<String> submitJob(String cubename,long startDate,long endDate,CubeBuildTypeEnum jobType) throws SchedulerException, IOException, InvalidJobInstanceException, CubeIntegrityException {
  CubeManager cubeMgr=CubeManager.getInstance(KylinConfig.getInstanceFromEnv());
  CubeInstance cube=cubeMgr.getCube(cubename);
  CubeManager.getInstance(this.getTestConfig()).loadCubeCache(cube);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<CubeSegment> newSegments=cubeMgr.allocateSegments(cube,jobType,startDate,endDate);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<String> jobUuids=Lists.newArrayList();
  List<JobInstance> jobs=Lists.newArrayList();
  for (  CubeSegment seg : newSegments) {
    String uuid=seg.getUuid();
    jobUuids.add(uuid);
    jobs.add(jobManager.createJob(cubename,seg.getName(),uuid,jobType));
    seg.setLastBuildJobID(uuid);
  }
  cubeMgr.updateCube(cube);
  for (  JobInstance job : jobs) {
    jobManager.submitJob(job);
  }
  return jobUuids;
}

Fixed version (ground truth):
protected List<String> submitJob(String cubename,long startDate,long endDate,CubeBuildTypeEnum jobType) throws SchedulerException, IOException, InvalidJobInstanceException, CubeIntegrityException {
  CubeManager cubeMgr=CubeManager.getInstance(KylinConfig.getInstanceFromEnv());
  CubeInstance cube=cubeMgr.getCube(cubename);
  CubeManager.getInstance(this.getTestConfig()).loadCubeCache(cube);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<CubeSegment> newSegments=cubeMgr.allocateSegments(cube,jobType,startDate,endDate);
  System.out.println(JsonUtil.writeValueAsIndentString(cube));
  List<String> jobUuids=Lists.newArrayList();
  List<JobInstance> jobs=Lists.newArrayList();
  for (  CubeSegment seg : newSegments) {
    String uuid=seg.getUuid();
    jobUuids.add(uuid);
    jobs.add(jobManager.createJob(cubename,seg.getName(),uuid,jobType));
  }
  for (  JobInstance job : jobs) {
    jobManager.submitJob(job);
  }
  return jobUuids;
}