Program: 4846
Project: 4846
Buggy source:
@Test public void testPartitionedFileSetWithMR() throws Exception {
  final ApplicationWithPrograms app=deployApp(AppWithPartitionedFileSet.class);
  final Table table=datasetCache.getDataset(AppWithPartitionedFileSet.INPUT);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)table).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      table.put(Bytes.toBytes("String_Node_Str"),AppWithPartitionedFileSet.ONLY_COLUMN,Bytes.toBytes("String_Node_Str"));
    }
  }
);
  final PartitionKey keyX=PartitionKey.builder().addStringField("String_Node_Str","String_Node_Str").addLongField("String_Node_Str",150000L).build();
  Map<String,String> runtimeArguments=Maps.newHashMap();
  Map<String,String> outputArgs=Maps.newHashMap();
  PartitionedFileSetArguments.setOutputPartitionKey(outputArgs,keyX);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,outputArgs));
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionWriter.class,new BasicArguments(runtimeArguments)));
  final PartitionedFileSet dataset=datasetCache.getDataset(PARTITIONED);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)dataset).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Partition partition=dataset.getPartition(keyX);
      Assert.assertNotNull(partition);
      String path=partition.getRelativePath();
      Assert.assertTrue(path.contains("String_Node_Str"));
      Assert.assertTrue(path.contains("String_Node_Str"));
    }
  }
);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)table).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      table.delete(Bytes.toBytes("String_Node_Str"));
      table.put(Bytes.toBytes("String_Node_Str"),AppWithPartitionedFileSet.ONLY_COLUMN,Bytes.toBytes("String_Node_Str"));
    }
  }
);
  final PartitionKey keyY=PartitionKey.builder().addStringField("String_Node_Str","String_Node_Str").addLongField("String_Node_Str",200000L).build();
  PartitionedFileSetArguments.setOutputPartitionKey(outputArgs,keyY);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,outputArgs));
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionWriter.class,new BasicArguments(runtimeArguments)));
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)dataset).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Partition partition=dataset.getPartition(keyY);
      Assert.assertNotNull(partition);
      String path=partition.getRelativePath();
      Assert.assertNotNull(path);
      Assert.assertTrue(path.contains("String_Node_Str"));
      Assert.assertTrue(path.contains("String_Node_Str"));
    }
  }
);
  PartitionFilter filterXY=PartitionFilter.builder().addRangeCondition("String_Node_Str","String_Node_Str","String_Node_Str").build();
  runtimeArguments=Maps.newHashMap();
  Map<String,String> inputArgs=Maps.newHashMap();
  PartitionedFileSetArguments.setInputPartitionFilter(inputArgs,filterXY);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,inputArgs));
  runtimeArguments.put(AppWithPartitionedFileSet.ROW_TO_WRITE,"String_Node_Str");
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionReader.class,new BasicArguments(runtimeArguments)));
  final Table output=datasetCache.getDataset(AppWithPartitionedFileSet.OUTPUT);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)output).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Row row=output.get(Bytes.toBytes("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
    }
  }
);
  PartitionFilter filterX=PartitionFilter.builder().addValueCondition("String_Node_Str","String_Node_Str").addRangeCondition("String_Node_Str",null,160000L).build();
  inputArgs.clear();
  PartitionedFileSetArguments.setInputPartitionFilter(inputArgs,filterX);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,inputArgs));
  runtimeArguments.put(AppWithPartitionedFileSet.ROW_TO_WRITE,"String_Node_Str");
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionReader.class,new BasicArguments(runtimeArguments)));
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)output).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Row row=output.get(Bytes.toBytes("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
      Assert.assertNull(row.get("String_Node_Str"));
    }
  }
);
  PartitionFilter filterMT=PartitionFilter.builder().addValueCondition("String_Node_Str","String_Node_Str").build();
  inputArgs.clear();
  PartitionedFileSetArguments.setInputPartitionFilter(inputArgs,filterMT);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,inputArgs));
  runtimeArguments.put(AppWithPartitionedFileSet.ROW_TO_WRITE,"String_Node_Str");
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionReader.class,new BasicArguments(runtimeArguments)));
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)output).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Row row=output.get(Bytes.toBytes("String_Node_Str"));
      Assert.assertTrue(row.isEmpty());
    }
  }
);
}

Fixed version (ground truth):
private void testPartitionedFileSetWithMR(boolean useCombineFileInputFormat) throws Exception {
  ApplicationWithPrograms app=deployApp(AppWithPartitionedFileSet.class,new AppWithPartitionedFileSet.AppConfig(useCombineFileInputFormat));
  final Table table=datasetCache.getDataset(AppWithPartitionedFileSet.INPUT);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)table).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      table.put(Bytes.toBytes("String_Node_Str"),AppWithPartitionedFileSet.ONLY_COLUMN,Bytes.toBytes("String_Node_Str"));
    }
  }
);
  final PartitionKey keyX=PartitionKey.builder().addStringField("String_Node_Str","String_Node_Str").addLongField("String_Node_Str",150000L).build();
  Map<String,String> runtimeArguments=Maps.newHashMap();
  Map<String,String> outputArgs=Maps.newHashMap();
  PartitionedFileSetArguments.setOutputPartitionKey(outputArgs,keyX);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,outputArgs));
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionWriter.class,new BasicArguments(runtimeArguments)));
  final PartitionedFileSet dataset=datasetCache.getDataset(PARTITIONED);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)dataset).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Partition partition=dataset.getPartition(keyX);
      Assert.assertNotNull(partition);
      String path=partition.getRelativePath();
      Assert.assertTrue(path.contains("String_Node_Str"));
      Assert.assertTrue(path.contains("String_Node_Str"));
    }
  }
);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)table).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      table.delete(Bytes.toBytes("String_Node_Str"));
      table.put(Bytes.toBytes("String_Node_Str"),AppWithPartitionedFileSet.ONLY_COLUMN,Bytes.toBytes("String_Node_Str"));
    }
  }
);
  final PartitionKey keyY=PartitionKey.builder().addStringField("String_Node_Str","String_Node_Str").addLongField("String_Node_Str",200000L).build();
  PartitionedFileSetArguments.setOutputPartitionKey(outputArgs,keyY);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,outputArgs));
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionWriter.class,new BasicArguments(runtimeArguments)));
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)dataset).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Partition partition=dataset.getPartition(keyY);
      Assert.assertNotNull(partition);
      String path=partition.getRelativePath();
      Assert.assertNotNull(path);
      Assert.assertTrue(path.contains("String_Node_Str"));
      Assert.assertTrue(path.contains("String_Node_Str"));
    }
  }
);
  PartitionFilter filterXY=PartitionFilter.builder().addRangeCondition("String_Node_Str","String_Node_Str","String_Node_Str").build();
  runtimeArguments=Maps.newHashMap();
  Map<String,String> inputArgs=Maps.newHashMap();
  PartitionedFileSetArguments.setInputPartitionFilter(inputArgs,filterXY);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,inputArgs));
  runtimeArguments.put(AppWithPartitionedFileSet.ROW_TO_WRITE,"String_Node_Str");
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionReader.class,new BasicArguments(runtimeArguments)));
  final Table output=datasetCache.getDataset(AppWithPartitionedFileSet.OUTPUT);
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)output).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Row row=output.get(Bytes.toBytes("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
    }
  }
);
  PartitionFilter filterX=PartitionFilter.builder().addValueCondition("String_Node_Str","String_Node_Str").addRangeCondition("String_Node_Str",null,160000L).build();
  inputArgs.clear();
  PartitionedFileSetArguments.setInputPartitionFilter(inputArgs,filterX);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,inputArgs));
  runtimeArguments.put(AppWithPartitionedFileSet.ROW_TO_WRITE,"String_Node_Str");
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionReader.class,new BasicArguments(runtimeArguments)));
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)output).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Row row=output.get(Bytes.toBytes("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
      Assert.assertEquals("String_Node_Str",row.getString("String_Node_Str"));
      Assert.assertNull(row.get("String_Node_Str"));
      Assert.assertNull(row.get("String_Node_Str"));
    }
  }
);
  PartitionFilter filterMT=PartitionFilter.builder().addValueCondition("String_Node_Str","String_Node_Str").build();
  inputArgs.clear();
  PartitionedFileSetArguments.setInputPartitionFilter(inputArgs,filterMT);
  runtimeArguments.putAll(RuntimeArguments.addScope(Scope.DATASET,PARTITIONED,inputArgs));
  runtimeArguments.put(AppWithPartitionedFileSet.ROW_TO_WRITE,"String_Node_Str");
  Assert.assertTrue(runProgram(app,AppWithPartitionedFileSet.PartitionReader.class,new BasicArguments(runtimeArguments)));
  Transactions.createTransactionExecutor(txExecutorFactory,(TransactionAware)output).execute(new TransactionExecutor.Subroutine(){
    @Override public void apply(){
      Row row=output.get(Bytes.toBytes("String_Node_Str"));
      Assert.assertTrue(row.isEmpty());
    }
  }
);
}