yupeng9 commented on a change in pull request #6113:
URL: https://github.com/apache/incubator-pinot/pull/6113#discussion_r503013913
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/indexsegment/mutable/MutableSegmentImpl.java
##########
@@ -453,6 +465,49 @@ public boolean index(GenericRow row, @Nullable RowMetadata
rowMetadata) {
return canTakeMore;
}
+ private boolean isUpsertEnabled() {
+ return _upsertMode != null && _upsertMode != UpsertConfig.Mode.NONE;
+ }
+
+ private void handleUpsert(GenericRow row, int docId) {
+ // below are upsert operations
+ PrimaryKey primaryKey = row.getPrimaryKey(_schema.getPrimaryKeyColumns());
+ Object timeValue = row.getValue(_timeColumnName);
+ Preconditions.checkArgument(timeValue instanceof Comparable, "time column
shall be comparable");
+ long timestamp = IngestionUtils.extractTimeValue((Comparable) timeValue);
+ RecordLocation location = new RecordLocation(_segmentName, docId,
timestamp);
+ // check local primary key index first
+ if (_primaryKeyIndex.containsKey(primaryKey)) {
Review comment:
Yes. This is a local cache in the mutable segment, and the cache is only
added to `_partitionUpsertMetadataManager ` during segment sealing. Note that
the docId may change during sealing, that's why `_primaryKeyIndex ` needs to be
recomputed at that time.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]