kasakrisz commented on code in PR #6023:
URL: https://github.com/apache/hive/pull/6023#discussion_r2272285458


##########
beeline/src/java/org/apache/hive/beeline/Rows.java:
##########
@@ -78,37 +82,43 @@ public void remove() {
    * JDBC driver property implements {@link ResultSetMetaData#getTableName} 
(many do not), it
    * is not reliable for all databases.
    */
-  boolean isPrimaryKey(int col) {
-    if (primaryKeys[col] == null) {
-      try {
-        // this doesn't always work, since some JDBC drivers (e.g.,
-        // Oracle's) return a blank string from getDbTableName.
-        String table = rsMeta.getTableName(col + 1);
-        String column = rsMeta.getColumnName(col + 1);
+  boolean isPrimaryKeyCol(int col) {
+    return primaryKeys[col];
+  }
 
-        if (table == null || table.isEmpty() || column == null || 
column.isEmpty()) {
-          primaryKeys[col] = Boolean.FALSE;
-        } else {
-          ResultSet pks = 
beeLine.getDatabaseConnection().getDatabaseMetaData().getPrimaryKeys(
-              
beeLine.getDatabaseConnection().getDatabaseMetaData().getConnection().getCatalog(),
 null, table);
-
-          primaryKeys[col] = Boolean.FALSE;
-          try {
-            while (pks.next()) {
-              if (column.equalsIgnoreCase(pks.getString("COLUMN_NAME"))) {
-                primaryKeys[col] = Boolean.TRUE;
-                break;
-              }
-            }
-          } finally {
-            pks.close();
+  private boolean[] initializePrimaryKeyMetadata() throws SQLException {
+
+    int count = this.rsMeta.getColumnCount();
+    boolean[] primaryKeys = new boolean[count];

Review Comment:
   Should this be initialized to all element false ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to