public class DefaultHoodieRecordPayload extends OverwriteWithLatestAvroPayload
HoodieRecordPayload impl that honors ordering field in both preCombine and combineAndGetUpdateValue.
1. preCombine - Picks the latest delta record for a key, based on an ordering field 2. combineAndGetUpdateValue/getInsertValue - Chooses the latest record based on ordering field value.
| Modifier and Type | Field and Description |
|---|---|
static String |
METADATA_EVENT_TIME_KEY |
orderingVal, recordBytes| Constructor and Description |
|---|
DefaultHoodieRecordPayload(org.apache.avro.generic.GenericRecord record,
Comparable orderingVal) |
DefaultHoodieRecordPayload(Option<org.apache.avro.generic.GenericRecord> record) |
| Modifier and Type | Method and Description |
|---|---|
Option<org.apache.avro.generic.IndexedRecord> |
combineAndGetUpdateValue(org.apache.avro.generic.IndexedRecord currentValue,
org.apache.avro.Schema schema,
Properties properties)
This methods lets you write custom merging/combining logic to produce new values as a function of current value on storage and whats contained
in this object.
|
Option<org.apache.avro.generic.IndexedRecord> |
getInsertValue(org.apache.avro.Schema schema,
Properties properties)
Generates an avro record out of the given HoodieRecordPayload, to be written out to storage.
|
Option<Map<String,String>> |
getMetadata()
This method can be used to extract some metadata from HoodieRecordPayload.
|
protected boolean |
needUpdatingPersistedRecord(org.apache.avro.generic.IndexedRecord currentValue,
org.apache.avro.generic.IndexedRecord incomingRecord,
Properties properties) |
combineAndGetUpdateValue, getInsertValue, getOrderingValue, isDeleteRecord, overwriteField, preCombineclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpreCombinepublic static final String METADATA_EVENT_TIME_KEY
public DefaultHoodieRecordPayload(org.apache.avro.generic.GenericRecord record,
Comparable orderingVal)
public DefaultHoodieRecordPayload(Option<org.apache.avro.generic.GenericRecord> record)
public Option<org.apache.avro.generic.IndexedRecord> combineAndGetUpdateValue(org.apache.avro.generic.IndexedRecord currentValue, org.apache.avro.Schema schema, Properties properties) throws IOException
HoodieRecordPayloadeg: 1) You are updating counters, you may want to add counts to currentValue and write back updated counts 2) You may be reading DB redo logs, and merge them with current image for a database row on storage
currentValue - Current value in storage, to merge/combine this payload withschema - Schema used for recordproperties - Payload related properties. For example pass the ordering field(s) name to extract from value in storage.IOExceptionpublic Option<org.apache.avro.generic.IndexedRecord> getInsertValue(org.apache.avro.Schema schema, Properties properties) throws IOException
HoodieRecordPayloadschema - Schema used for recordproperties - Payload related properties. For example pass the ordering field(s) name to extract from value in storage.IndexedRecord to be inserted.IOExceptionpublic Option<Map<String,String>> getMetadata()
HoodieRecordPayloadWriteStatus.markSuccess() and
WriteStatus.markFailure() in order to compute some aggregate metrics using the metadata in the context of a write success or failure.protected boolean needUpdatingPersistedRecord(org.apache.avro.generic.IndexedRecord currentValue,
org.apache.avro.generic.IndexedRecord incomingRecord,
Properties properties)
Copyright © 2022 The Apache Software Foundation. All rights reserved.