the-other-tim-brown commented on code in PR #13242:
URL: https://github.com/apache/hudi/pull/13242#discussion_r2096278521
##########
hudi-common/src/main/java/org/apache/hudi/common/engine/HoodieReaderContext.java:
##########
@@ -262,30 +265,52 @@ private BiFunction<T, Schema, String>
virtualKeyExtractor(String[] recordKeyFiel
/**
* Gets the ordering value in particular type.
*
- * @param record An option of record.
+ * @param record An engine specific record.
* @param schema The Avro schema of the record.
- * @param orderingFieldName name of the ordering field
+ * @param orderingFieldName name of the ordering field, if any
* @return The ordering value.
*/
- public Comparable getOrderingValue(T record,
- Schema schema,
- Option<String> orderingFieldName) {
+ public Comparable getOrderingValue(T record, Schema schema, Option<String>
orderingFieldName) {
if (orderingFieldName.isEmpty()) {
return DEFAULT_ORDERING_VALUE;
}
Object value = getValue(record, schema, orderingFieldName.get());
- Comparable finalOrderingVal = value != null ?
convertValueToEngineType((Comparable) value) : DEFAULT_ORDERING_VALUE;
- return finalOrderingVal;
+ return value != null ? convertValueToEngineType((Comparable) value) :
DEFAULT_ORDERING_VALUE;
}
/**
* Constructs a new {@link HoodieRecord} based on the given buffered record
{@link BufferedRecord}.
+ * Safe to assume that the buffered record is not a delete.
*
* @param bufferedRecord The {@link BufferedRecord} object with
engine-specific row
* @return A new instance of {@link HoodieRecord}.
*/
- public abstract HoodieRecord<T> constructHoodieRecord(BufferedRecord<T>
bufferedRecord);
+ protected abstract HoodieRecord<T>
constructHoodieDataRecord(BufferedRecord<T> bufferedRecord);
+
+ /**
+ * Constructs a new {@link HoodieRecord} based on the given buffered record
{@link BufferedRecord}.
+ *
+ * @param bufferedRecord The {@link BufferedRecord} object with
engine-specific row
+ * @return A new instance of {@link HoodieRecord}.
+ */
+ public HoodieRecord<T> constructHoodieRecord(BufferedRecord<T>
bufferedRecord) {
+ if (bufferedRecord.isDelete()) {
+ return new HoodieEmptyRecord<>(
Review Comment:
I've updated this to check for `null` instead of `isDelete`
--
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]