Program: 112423
Project: 112423
Buggy source:
protected void helpTestCreateAndUpdate(boolean mutable,boolean localIndex) throws Exception {
  String dataTableName=generateUniqueName();
  String fullDataTableName=INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + dataTableName;
  String indexName=generateUniqueName();
  Properties props=PropertiesUtil.deepCopy(TEST_PROPERTIES);
  Connection conn=DriverManager.getConnection(getUrl(),props);
  try {
    conn.setAutoCommit(false);
    createDataTable(conn,fullDataTableName,mutable ? "String_Node_Str" : "String_Node_Str");
    populateDataTable(conn,fullDataTableName);
    String ddl="String_Node_Str" + (localIndex ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ indexName+ "String_Node_Str"+ fullDataTableName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    PreparedStatement stmt=conn.prepareStatement(ddl);
    stmt.execute();
    String whereSql="String_Node_Str" + fullDataTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    stmt=conn.prepareStatement(whereSql);
    stmt.setString(1,"String_Node_Str");
    stmt.setInt(2,3);
    Date date=DateUtil.parseDate("String_Node_Str");
    stmt.setDate(3,date);
    stmt.setDate(4,date);
    stmt.setDate(5,date);
    ResultSet rs=stmt.executeQuery("String_Node_Str" + whereSql);
    assertEquals(localIndex ? "String_Node_Str" + dataTableName + "String_Node_Str" : "String_Node_Str" + indexName + "String_Node_Str",QueryUtil.getExplainPlan(rs));
    rs=stmt.executeQuery();
    assertTrue(rs.next());
    assertEquals(1,rs.getInt(1));
    assertEquals(1,rs.getInt(2));
    assertFalse(rs.next());
    String indexSelectSql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ fullDataTableName;
    rs=conn.createStatement().executeQuery("String_Node_Str" + indexSelectSql);
    assertEquals(localIndex ? "String_Node_Str" + fullDataTableName + "String_Node_Str" : "String_Node_Str" + indexName,QueryUtil.getExplainPlan(rs));
    rs=conn.createStatement().executeQuery(indexSelectSql);
    verifyResult(rs,1);
    verifyResult(rs,2);
    String upsert="String_Node_Str" + fullDataTableName + "String_Node_Str";
    stmt=conn.prepareStatement(upsert);
    insertRow(stmt,3);
    insertRow(stmt,4);
    conn.commit();
    rs=conn.createStatement().executeQuery(indexSelectSql);
    verifyResult(rs,1);
    verifyResult(rs,2);
    verifyResult(rs,3);
    verifyResult(rs,4);
    conn.createStatement().execute("String_Node_Str" + indexName + "String_Node_Str"+ fullDataTableName);
  }
  finally {
    conn.close();
  }
}

Fixed version (ground truth):
protected void helpTestCreateAndUpdate(boolean mutable,boolean localIndex) throws Exception {
  String dataTableName=generateUniqueName();
  String fullDataTableName=INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + dataTableName;
  String indexName=generateUniqueName();
  Properties props=PropertiesUtil.deepCopy(TEST_PROPERTIES);
  Connection conn=DriverManager.getConnection(getUrl(),props);
  try {
    conn.setAutoCommit(false);
    createDataTable(conn,fullDataTableName,mutable ? "String_Node_Str" : "String_Node_Str");
    populateDataTable(conn,fullDataTableName);
    String ddl="String_Node_Str" + (localIndex ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ indexName+ "String_Node_Str"+ fullDataTableName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    conn.createStatement().execute(ddl);
    String whereSql="String_Node_Str" + fullDataTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    PreparedStatement stmt=conn.prepareStatement(whereSql);
    stmt.setString(1,"String_Node_Str");
    stmt.setInt(2,3);
    Date date=DateUtil.parseDate("String_Node_Str");
    stmt.setDate(3,date);
    stmt.setDate(4,date);
    stmt.setDate(5,date);
    ResultSet rs=stmt.executeQuery("String_Node_Str" + whereSql);
    assertEquals(localIndex ? "String_Node_Str" + dataTableName + "String_Node_Str" : "String_Node_Str" + indexName + "String_Node_Str",QueryUtil.getExplainPlan(rs));
    rs=stmt.executeQuery();
    assertTrue(rs.next());
    assertEquals(1,rs.getInt(1));
    assertEquals(1,rs.getInt(2));
    assertFalse(rs.next());
    String indexSelectSql="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ fullDataTableName;
    rs=conn.createStatement().executeQuery("String_Node_Str" + indexSelectSql);
    assertEquals(localIndex ? "String_Node_Str" + fullDataTableName + "String_Node_Str" : "String_Node_Str" + indexName,QueryUtil.getExplainPlan(rs));
    rs=conn.createStatement().executeQuery(indexSelectSql);
    verifyResult(rs,1);
    verifyResult(rs,2);
    String upsert="String_Node_Str" + fullDataTableName + "String_Node_Str";
    stmt=conn.prepareStatement(upsert);
    insertRow(stmt,3);
    insertRow(stmt,4);
    conn.commit();
    rs=conn.createStatement().executeQuery(indexSelectSql);
    verifyResult(rs,1);
    verifyResult(rs,2);
    verifyResult(rs,3);
    verifyResult(rs,4);
    conn.createStatement().execute("String_Node_Str" + indexName + "String_Node_Str"+ fullDataTableName);
  }
  finally {
    conn.close();
  }
}