You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/27 06:38:33 UTC

[GitHub] [pinot] navina commented on a diff in pull request #9851: Merge new columns in existing record with default merge strategy

navina commented on code in PR #9851:
URL: https://github.com/apache/pinot/pull/9851#discussion_r1032875455


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/PartialUpsertHandler.java:
##########
@@ -65,15 +73,18 @@ public PartialUpsertHandler(Schema schema, Map<String, UpsertConfig.Strategy> pa
    * @return a new row after merge
    */
   public GenericRow merge(GenericRow previousRecord, GenericRow newRecord) {
-    for (Map.Entry<String, PartialUpsertMerger> entry : _column2Mergers.entrySet()) {
-      String column = entry.getKey();
-      if (!previousRecord.isNullValue(column)) {
-        if (newRecord.isNullValue(column)) {
-          newRecord.putValue(column, previousRecord.getValue(column));
-          newRecord.removeNullValueField(column);
-        } else {
-          newRecord.putValue(column,
-              entry.getValue().merge(previousRecord.getValue(column), newRecord.getValue(column)));
+    for (String column : previousRecord.getFieldToValueMap().keySet()) {

Review Comment:
   the new column will always be present in `newRecord` (which is equivalent to an overwrite strategy). if there is an update to the same primary key, then the previous record will have that new column value and iterate through this loop. So, it should be fine to iterate through the columns of the previous record, right? 



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org