public abstract class HoodieBaseFileGroupRecordBuffer<T> extends Object implements HoodieFileGroupRecordBuffer<T>
HoodieFileGroupRecordBuffer.BufferType| Modifier and Type | Field and Description |
|---|---|
protected ClosableIterator<T> |
baseFileIterator |
protected boolean |
enablePartialMerging |
protected HoodieTableMetaClient |
hoodieTableMetaClient |
protected InternalSchema |
internalSchema |
protected Iterator<Pair<Option<T>,Map<String,Object>>> |
logRecordIterator |
protected T |
nextRecord |
protected Option<String> |
partitionNameOverrideOpt |
protected Option<String[]> |
partitionPathFieldOpt |
protected TypedProperties |
props |
protected HoodieReaderContext<T> |
readerContext |
protected org.apache.avro.Schema |
readerSchema |
protected RecordMergeMode |
recordMergeMode |
protected HoodieRecordMerger |
recordMerger |
protected ExternalSpillableMap<Serializable,Pair<Option<T>,Map<String,Object>>> |
records |
| Constructor and Description |
|---|
HoodieBaseFileGroupRecordBuffer(HoodieReaderContext<T> readerContext,
HoodieTableMetaClient hoodieTableMetaClient,
Option<String> partitionNameOverrideOpt,
Option<String[]> partitionPathFieldOpt,
HoodieRecordMerger recordMerger,
TypedProperties props) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected Option<Pair<Function<T,T>,org.apache.avro.Schema>> |
composeEvolvedSchemaTransformer(HoodieDataBlock dataBlock)
Get final Read Schema for support evolution.
|
protected abstract boolean |
doHasNext()
This allows hasNext() to be called multiple times without incrementing the iterator by more than 1
record.
|
protected Option<Pair<T,Map<String,Object>>> |
doProcessNextDataRecord(T record,
Map<String,Object> metadata,
Pair<Option<T>,Map<String,Object>> existingRecordMetadataPair)
Merge two log data records if needed.
|
protected Option<DeleteRecord> |
doProcessNextDeletedRecord(DeleteRecord deleteRecord,
Pair<Option<T>,Map<String,Object>> existingRecordMetadataPair)
Merge a delete record with another record (data, or delete).
|
Iterator<Pair<Option<T>,Map<String,Object>>> |
getLogRecordIterator() |
Map<Serializable,Pair<Option<T>,Map<String,Object>>> |
getLogRecords() |
protected Pair<ClosableIterator<T>,org.apache.avro.Schema> |
getRecordsIterator(HoodieDataBlock dataBlock,
Option<KeySpec> keySpecOpt)
Create a record iterator for a data block.
|
protected Pair<Function<T,T>,org.apache.avro.Schema> |
getSchemaTransformerWithEvolvedSchema(HoodieDataBlock dataBlock) |
boolean |
hasNext()
Check if next merged record exists.
|
protected boolean |
hasNextBaseRecord(T baseRecord,
Pair<Option<T>,Map<String,Object>> logRecordInfo) |
protected boolean |
hasNextLogRecord() |
protected Option<T> |
merge(Option<T> older,
Map<String,Object> olderInfoMap,
Option<T> newer,
Map<String,Object> newerInfoMap)
Merge two records using the configured record merger.
|
T |
next() |
void |
setBaseFileIterator(ClosableIterator<T> baseFileIterator)
Link the base file iterator for consequential merge.
|
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontainsLogRecord, getBufferType, processDataBlock, processDeleteBlock, processNextDataRecord, processNextDeletedRecordprotected final HoodieReaderContext<T> readerContext
protected final org.apache.avro.Schema readerSchema
protected final RecordMergeMode recordMergeMode
protected final HoodieRecordMerger recordMerger
protected final TypedProperties props
protected final ExternalSpillableMap<Serializable,Pair<Option<T>,Map<String,Object>>> records
protected ClosableIterator<T> baseFileIterator
protected T nextRecord
protected boolean enablePartialMerging
protected InternalSchema internalSchema
protected HoodieTableMetaClient hoodieTableMetaClient
public HoodieBaseFileGroupRecordBuffer(HoodieReaderContext<T> readerContext, HoodieTableMetaClient hoodieTableMetaClient, Option<String> partitionNameOverrideOpt, Option<String[]> partitionPathFieldOpt, HoodieRecordMerger recordMerger, TypedProperties props)
public void setBaseFileIterator(ClosableIterator<T> baseFileIterator)
HoodieFileGroupRecordBuffersetBaseFileIterator in interface HoodieFileGroupRecordBuffer<T>protected abstract boolean doHasNext()
throws IOException
IOExceptionpublic final boolean hasNext()
throws IOException
HoodieFileGroupRecordBufferhasNext in interface HoodieFileGroupRecordBuffer<T>IOExceptionpublic final T next()
next in interface HoodieFileGroupRecordBuffer<T>public Map<Serializable,Pair<Option<T>,Map<String,Object>>> getLogRecords()
getLogRecords in interface HoodieFileGroupRecordBuffer<T>public int size()
size in interface HoodieFileGroupRecordBuffer<T>public Iterator<Pair<Option<T>,Map<String,Object>>> getLogRecordIterator()
getLogRecordIterator in interface HoodieFileGroupRecordBuffer<T>public void close()
close in interface HoodieFileGroupRecordBuffer<T>protected Option<Pair<T,Map<String,Object>>> doProcessNextDataRecord(T record, Map<String,Object> metadata, Pair<Option<T>,Map<String,Object>> existingRecordMetadataPair) throws IOException
record - metadata - existingRecordMetadataPair - IOExceptionprotected Option<DeleteRecord> doProcessNextDeletedRecord(DeleteRecord deleteRecord, Pair<Option<T>,Map<String,Object>> existingRecordMetadataPair)
deleteRecord - existingRecordMetadataPair - protected Pair<ClosableIterator<T>,org.apache.avro.Schema> getRecordsIterator(HoodieDataBlock dataBlock, Option<KeySpec> keySpecOpt)
keySpecOpt.dataBlock - keySpecOpt - protected Option<Pair<Function<T,T>,org.apache.avro.Schema>> composeEvolvedSchemaTransformer(HoodieDataBlock dataBlock)
dataBlock - current processed blockprotected Option<T> merge(Option<T> older, Map<String,Object> olderInfoMap, Option<T> newer, Map<String,Object> newerInfoMap) throws IOException
older - olderInfoMap - newer - newerInfoMap - IOExceptionprotected boolean hasNextBaseRecord(T baseRecord, Pair<Option<T>,Map<String,Object>> logRecordInfo) throws IOException
IOExceptionprotected boolean hasNextLogRecord()
throws IOException
IOExceptionprotected Pair<Function<T,T>,org.apache.avro.Schema> getSchemaTransformerWithEvolvedSchema(HoodieDataBlock dataBlock)
Copyright © 2024 The Apache Software Foundation. All rights reserved.