Program: 112429
Project: 112429
Buggy source:
protected void helpTestSelectDistinct(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";
    PreparedStatement stmt=conn.prepareStatement(ddl);
    stmt.execute();
    String sql="String_Node_Str" + fullDataTableName + "String_Node_Str";
    ResultSet rs=conn.createStatement().executeQuery("String_Node_Str" + sql);
    String expectedPlan="String_Node_Str" + (localIndex ? fullDataTableName + "String_Node_Str" : "String_Node_Str" + indexName + "String_Node_Str") + "String_Node_Str"+ (localIndex ? "String_Node_Str" : "String_Node_Str");
    assertEquals(expectedPlan,QueryUtil.getExplainPlan(rs));
    rs=conn.createStatement().executeQuery(sql);
    assertTrue(rs.next());
    assertEquals(2,rs.getInt(1));
    assertTrue(rs.next());
    assertEquals(3,rs.getInt(1));
    assertFalse(rs.next());
    conn.createStatement().execute("String_Node_Str" + indexName + "String_Node_Str"+ fullDataTableName);
  }
  finally {
    conn.close();
  }
}

Fixed version (ground truth):
protected void helpTestSelectDistinct(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";
    conn.createStatement().execute(ddl);
    String sql="String_Node_Str" + fullDataTableName + "String_Node_Str";
    ResultSet rs=conn.createStatement().executeQuery("String_Node_Str" + sql);
    String expectedPlan="String_Node_Str" + (localIndex ? fullDataTableName + "String_Node_Str" : "String_Node_Str" + indexName + "String_Node_Str") + "String_Node_Str"+ (localIndex ? "String_Node_Str" : "String_Node_Str");
    assertEquals(expectedPlan,QueryUtil.getExplainPlan(rs));
    rs=conn.createStatement().executeQuery(sql);
    assertTrue(rs.next());
    assertEquals(2,rs.getInt(1));
    assertTrue(rs.next());
    assertEquals(3,rs.getInt(1));
    assertFalse(rs.next());
    conn.createStatement().execute("String_Node_Str" + indexName + "String_Node_Str"+ fullDataTableName);
  }
  finally {
    conn.close();
  }
}