danny0405 commented on code in PR #13242:
URL: https://github.com/apache/hudi/pull/13242#discussion_r2078753232
##########
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);
Review Comment:
For example, the schema is (`id`, `name`, `val`) and the `id` is the record
key, there is an insert then update to the value of it, you have msg events
like below and the operator sends one msg at a time to the downstream:
```java
[+I] [1, "a", 1]
[-U] [1, "a", 1]
[+U] [1, "a", 3]
```
The `-U` msg is a retraction msg to downstream, when the downstream
operators received the msg, it would minus the current value `1` with `1` so it
becomes `0`.
The point here is to keep the data payload of the delete msg so the
downstream can figure out the value to subtract.
--
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]