You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "David Mollitor (Jira)" <ji...@apache.org> on 2020/04/27 15:59:00 UTC
[jira] [Assigned] (HIVE-23307) Cache ColumnIndex in
HiveBaseResultSet
[ https://issues.apache.org/jira/browse/HIVE-23307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Mollitor reassigned HIVE-23307:
-------------------------------------
Assignee: David Mollitor
> Cache ColumnIndex in HiveBaseResultSet
> --------------------------------------
>
> Key: HIVE-23307
> URL: https://issues.apache.org/jira/browse/HIVE-23307
> Project: Hive
> Issue Type: New Feature
> Components: JDBC
> Affects Versions: 3.1.2
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Major
>
> {code:java}
> public int findColumn(String columnName) throws SQLException {
> int columnIndex = 0;
> boolean findColumn = false;
> for (String normalizedColumnName : normalizedColumnNames) {
> ++columnIndex;
> String[] names = normalizedColumnName.split("\\.");
> String name = names[names.length -1];
> if (name.equalsIgnoreCase(columnName) || normalizedColumnName.equalsIgnoreCase(columnName)) {
> findColumn = true;
> break;
> }
> }
> if (!findColumn) {
> throw new SQLException("Could not find " + columnName + " in " + normalizedColumnNames);
> } else {
> return columnIndex;
> }
> }
> {code}
> Cache the column name to column index map to avoid having to look it up again and again for each row O(n^2)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)