InvisibleProgrammer commented on code in PR #6023: URL: https://github.com/apache/hive/pull/6023#discussion_r2276400660
########## beeline/src/java/org/apache/hive/beeline/Rows.java: ########## @@ -51,14 +55,14 @@ abstract class Rows implements Iterator { this.beeLine = beeLine; nullStr = beeLine.getOpts().getNullString(); rsMeta = rs.getMetaData(); - int count = rsMeta.getColumnCount(); - primaryKeys = new Boolean[count]; if (beeLine.getOpts().getNumberFormat().equals("default")) { numberFormat = null; } else { numberFormat = new DecimalFormat(beeLine.getOpts().getNumberFormat()); } this.convertBinaryArrayToString = beeLine.getOpts().getConvertBinaryArrayToString(); + + primaryKeys = initializePrimaryKeyMetadata(); Review Comment: I don't see a use case when we create multiple Rows instances for a single ResultSet: https://github.com/apache/hive/blob/master/beeline/src/java/org/apache/hive/beeline/BeeLine.java#L2426 Is there any special use case in your mind that I don't know about? About querying it when coloring is disabled: it is an interesting question: The current structure of the code behaves in a way that the Rows object doesn't know if it will be used in a coloring or non-coloring use case. Also doesn't know if coloring is exists at all. The best alternative that I can think about is to fill the information only if the `isPrimaryKeyCol` method is called. But it can also make the code a little bit more complex if we introduce a lazy-loading mechanism. I think handling the situation only once and at the beginning of the class can be a logical place between doing hundreds of unnecessary calls and zero calls at all - and also keeping the complexity low. What are your opinions? -- 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