linliu-code commented on code in PR #12843:
URL: https://github.com/apache/hudi/pull/12843#discussion_r2003346568
##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/FileGroupRecordBuffer.java:
##########
@@ -143,6 +148,29 @@ public
HoodieBaseFileGroupRecordBuffer(HoodieReaderContext<T> readerContext,
} catch (IOException e) {
throw new HoodieIOException("IOException when creating
ExternalSpillableMap at " + spillableMapBasePath, e);
}
+ this.shouldCheckCustomDeleteMarker = hasCustomDeleteConfigs(props,
readerSchema);
+ if (shouldCheckCustomDeleteMarker) {
+ this.customDeleteMarkerKey = props.getProperty(DELETE_KEY);
+ this.customDeleteMarkerValue = props.getProperty(DELETE_MARKER);
+ }
+ }
+
+ protected boolean hasCustomDeleteConfigs(TypedProperties props, Schema
schema) {
+ // DELETE_KEY and DELETE_MARKER both should be set.
+ if (StringUtils.isNullOrEmpty(props.getProperty(DELETE_KEY))
+ || StringUtils.isNullOrEmpty(props.getProperty(DELETE_MARKER))) {
+ return false;
+ }
+ // Schema should have the DELETE_KEY field.
+ String deleteKeyField = props.getProperty(DELETE_KEY);
+ return schema.getField(deleteKeyField) != null;
+ }
+
+ protected boolean isCustomDeleteRecord(T record) {
+ Object deleteMarkerValue =
+ readerContext.getValue(record, readerSchema, customDeleteMarkerKey);
+ return deleteMarkerValue != null
+ && customDeleteMarkerValue.equals(deleteMarkerValue.toString());
Review Comment:
Done.
--
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]