@Test
  public void testResultSetMetaDataDuplicateColumnNames() throws SQLException {
    Statement stmt = con.createStatement();

    ResultSet res = stmt.executeQuery("select c1 as c2_1, c2, c1*2 from "
        + dataTypeTableName + " limit 1");
    ResultSetMetaData meta = res.getMetaData();

    ResultSet colRS = con.getMetaData().getColumns(null, null,
        dataTypeTableName.toLowerCase(), null);

    assertEquals(3, meta.getColumnCount());

    assertTrue(colRS.next());

    assertEquals("c2_1", meta.getColumnName(1));

    assertTrue(colRS.next());

    assertEquals("c2", meta.getColumnName(2));

    assertTrue(colRS.next());

    assertEquals("_c2", meta.getColumnName(3));
    
  }
Validate the Metadata for the result set of a metadata getColumns call.
itests/hive-unit/src/test/java/org/apache/hive/jdbc/cbo_rp_TestJdbcDriver2.java