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 |
DELETE_KEY |
static String |
DELETE_MARKER |
static String |
METADATA_EVENT_TIME_KEY |
isDeletedRecord, 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.
|
boolean |
isDeleted(org.apache.avro.Schema schema,
Properties props)
Defines whether this implementation of
HoodieRecordPayload is deleted. |
protected boolean |
isDeleteRecord(org.apache.avro.generic.GenericRecord genericRecord,
Properties properties) |
protected boolean |
needUpdatingPersistedRecord(org.apache.avro.generic.IndexedRecord currentValue,
org.apache.avro.generic.IndexedRecord incomingRecord,
Properties properties) |
combineAndGetUpdateValue, getInsertValue, getOrderingValue, overwriteField, preCombinecanProduceSentinel, getOrderingVal, isDeleteRecordclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpreCombine, preCombinepublic static final String METADATA_EVENT_TIME_KEY
public static final String DELETE_KEY
public static final String DELETE_MARKER
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 boolean isDeleted(org.apache.avro.Schema schema,
Properties props)
BaseAvroPayloadHoodieRecordPayload is deleted.
We will not do deserialization in this method.isDeleted in class BaseAvroPayloadprotected boolean isDeleteRecord(org.apache.avro.generic.GenericRecord genericRecord,
Properties properties)
genericRecord - instance of GenericRecord of interest.properties - payload related propertiespublic 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 © 2024 The Apache Software Foundation. All rights reserved.