Jackie-Jiang commented on code in PR #9604:
URL: https://github.com/apache/pinot/pull/9604#discussion_r996270409


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/UpsertUtils.java:
##########
@@ -69,37 +70,78 @@ public boolean hasNext() {
 
       @Override
       public RecordInfo next() {
-        return getRecordInfo(segment, primaryKeyColumns, comparisonColumn, 
_docIdIterator.next());
+        return getRecordInfo(recordInfoReader, _docIdIterator.next());
       }
     };
   }
 
   /**
    * Reads a {@link RecordInfo} from the segment.
    */
-  public static RecordInfo getRecordInfo(ImmutableSegment segment, 
List<String> primaryKeyColumns,
-      String comparisonColumn, int docId) {
-    PrimaryKey primaryKey = new PrimaryKey(new 
Object[primaryKeyColumns.size()]);
-    getPrimaryKey(segment, primaryKeyColumns, docId, primaryKey);
-    Object comparisonValue = segment.getValue(docId, comparisonColumn);
-    if (comparisonValue instanceof byte[]) {
-      comparisonValue = new ByteArray((byte[]) comparisonValue);
-    }
+  public static RecordInfo getRecordInfo(RecordInfoReader recordInfoReader, 
int docId) {
+    PrimaryKey primaryKey = new PrimaryKey(new 
Object[recordInfoReader.getNumPrimaryKeys()]);
+    getPrimaryKey(recordInfoReader._primaryKeyReader, docId, primaryKey);
+    Object comparisonValue = 
getValue(recordInfoReader._comparisonColumnReader, docId);
     return new RecordInfo(primaryKey, docId, (Comparable) comparisonValue);
   }
 
   /**
    * Reads a primary key from the segment.
    */
-  public static void getPrimaryKey(IndexSegment segment, List<String> 
primaryKeyColumns, int docId, PrimaryKey buffer) {
+  public static void getPrimaryKey(PrimaryKeyReader primaryKeyReader, int 
docId, PrimaryKey buffer) {
     Object[] values = buffer.getValues();
     int numPrimaryKeyColumns = values.length;
     for (int i = 0; i < numPrimaryKeyColumns; i++) {
-      Object value = segment.getValue(docId, primaryKeyColumns.get(i));
-      if (value instanceof byte[]) {
-        value = new ByteArray((byte[]) value);
+      values[i] = getValue(primaryKeyReader._primaryKeyColumnReaders.get(i), 
docId);

Review Comment:
   Good point! That should be much cleaner



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to