[ https://issues.apache.org/jira/browse/HIVE-8330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14157160#comment-14157160 ]
Brock Noland commented on HIVE-8330: ------------------------------------ Hi [~spena], Thank you for jumping on this!! I think it's possible for the members of columnNames to be any case. Assuming that is true, then I think that in the constructor of HiveBaseResultSet we'll have to copy the strings to a new list normalizedColumnNames as lower case. Then we use that list to check for existence in that list. The reason I think we should have a separate list is in HiveResultSetMetaData we actually return the name of the column to the user and we should be consistent with whatever case were returning previously... Thank you!! Brock > HiveResultSet.findColumn() parameters are case sensitive > -------------------------------------------------------- > > Key: HIVE-8330 > URL: https://issues.apache.org/jira/browse/HIVE-8330 > Project: Hive > Issue Type: Bug > Affects Versions: 0.13.1 > Reporter: Sergio Peña > Assignee: Sergio Peña > Attachments: HIVE-8330.1.patch > > > Look at the following code: > {noformat} > Class.forName("org.apache.hive.jdbc.HiveDriver"); > Connection db = null; > Statement stmt = null; > ResultSet rs = null; > try { > db = > DriverManager.getConnection("jdbc:hive2://localhost:10000/default", "hive", > ""); > stmt = db.createStatement(); > rs = stmt.executeQuery("SELECT * FROM sample_07 limit 1"); > ResultSetMetaData metaData = rs.getMetaData(); > for (int i = 1; i <= metaData.getColumnCount(); i++) { > System.out.println("Column " + i + ": " + > metaData.getColumnName(i)); > } > while (rs.next()) { > System.out.println(rs.findColumn("code")); > } > } finally { > DbUtils.closeQuietly(db, stmt, rs); > } > {noformat} > Above program will generate following result on my cluster: > {noformat} > Column 1: code > Column 2: description > Column 3: total_emp > Column 4: salary > 1 > {noformat} > However, if the last print sentence is changed as following (using uppercase > characters): > {noformat} > System.out.println(rs.findColumn("Code")); > {noformat} > The program will fail at exactly that line. The same happens if the column > name is changed as "CODE" > Based on the JDBC ResultSet documentation, this method should be case > insensitive. > "Column names used as input to getter methods are case insensitive" > http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html -- This message was sent by Atlassian JIRA (v6.3.4#6332)