public abstract class HoodieDataBlock extends HoodieLogBlock
The Datablock contains: 1. Data Block version 2. Total number of records in the block 3. Actual serialized content of the records
HoodieLogBlock.FooterMetadataType, HoodieLogBlock.HeaderMetadataType, HoodieLogBlock.HoodieLogBlockContentLocation, HoodieLogBlock.HoodieLogBlockType| Modifier and Type | Field and Description |
|---|---|
protected org.apache.avro.Schema |
readerSchema |
protected boolean |
shouldWriteRecordPositions |
readBlockLazily, version| Modifier | Constructor and Description |
|---|---|
|
HoodieDataBlock(List<HoodieRecord> records,
boolean shouldWriteRecordPositions,
Map<HoodieLogBlock.HeaderMetadataType,String> header,
Map<HoodieLogBlock.HeaderMetadataType,String> footer,
String keyFieldName)
NOTE: This ctor is used on the write-path (ie when records ought to be written into the log)
|
protected |
HoodieDataBlock(Option<byte[]> content,
Supplier<SeekableDataInputStream> inputStreamSupplier,
boolean readBlockLazily,
Option<HoodieLogBlock.HoodieLogBlockContentLocation> blockContentLocation,
Option<org.apache.avro.Schema> readerSchema,
Map<HoodieLogBlock.HeaderMetadataType,String> headers,
Map<HoodieLogBlock.HeaderMetadataType,String> footer,
String keyFieldName,
boolean enablePointLookups)
NOTE: This ctor is used on the write-path (ie when records ought to be written into the log)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsPartialUpdates() |
protected abstract <T> ClosableIterator<HoodieRecord<T>> |
deserializeRecords(byte[] content,
HoodieRecord.HoodieRecordType type) |
protected abstract <T> ClosableIterator<T> |
deserializeRecords(HoodieReaderContext<T> readerContext,
byte[] content)
Deserializes the content bytes of the data block to the records in engine-specific representation.
|
abstract HoodieLogBlock.HoodieLogBlockType |
getBlockType() |
byte[] |
getContentBytes(HoodieStorage storage) |
<T> ClosableIterator<T> |
getEngineRecordIterator(HoodieReaderContext<T> readerContext)
Returns all the records in the type of engine-specific record representation contained
within this block in an iterator.
|
<T> ClosableIterator<T> |
getEngineRecordIterator(HoodieReaderContext<T> readerContext,
List<String> keys,
boolean fullKey)
Batch get of keys of interest.
|
protected Option<org.apache.avro.Schema.Field> |
getKeyField(org.apache.avro.Schema schema) |
String |
getKeyFieldName() |
<T> ClosableIterator<HoodieRecord<T>> |
getRecordIterator(HoodieRecord.HoodieRecordType type)
Returns all the records iterator contained w/in this block.
|
<T> ClosableIterator<HoodieRecord<T>> |
getRecordIterator(List<String> keys,
boolean fullKey,
HoodieRecord.HoodieRecordType type)
Batch get of keys of interest.
|
protected Option<String> |
getRecordKey(HoodieRecord record) |
org.apache.avro.Schema |
getSchema() |
protected org.apache.avro.Schema |
getSchemaFromHeader() |
protected static org.apache.avro.Schema |
getWriterSchema(Map<HoodieLogBlock.HeaderMetadataType,String> logBlockHeader) |
protected <T> ClosableIterator<HoodieRecord<T>> |
lookupRecords(List<String> keys,
boolean fullKey) |
protected <T> ClosableIterator<T> |
readRecordsFromBlockPayload(HoodieReaderContext<T> readerContext) |
protected <T> ClosableIterator<HoodieRecord<T>> |
readRecordsFromBlockPayload(HoodieRecord.HoodieRecordType type) |
protected abstract byte[] |
serializeRecords(List<HoodieRecord> records,
HoodieStorage storage) |
addRecordPositionsToHeader, deflate, getBlockContentLocation, getContent, getLogBlockFooter, getLogBlockHeader, getLogBlockLength, getLogMetadata, getLogMetadataBytes, getMagic, getRecordPositions, inflate, isCompactedLogBlock, tryReadContentprotected org.apache.avro.Schema readerSchema
protected final boolean shouldWriteRecordPositions
public HoodieDataBlock(List<HoodieRecord> records, boolean shouldWriteRecordPositions, Map<HoodieLogBlock.HeaderMetadataType,String> header, Map<HoodieLogBlock.HeaderMetadataType,String> footer, String keyFieldName)
protected HoodieDataBlock(Option<byte[]> content, Supplier<SeekableDataInputStream> inputStreamSupplier, boolean readBlockLazily, Option<HoodieLogBlock.HoodieLogBlockContentLocation> blockContentLocation, Option<org.apache.avro.Schema> readerSchema, Map<HoodieLogBlock.HeaderMetadataType,String> headers, Map<HoodieLogBlock.HeaderMetadataType,String> footer, String keyFieldName, boolean enablePointLookups)
public byte[] getContentBytes(HoodieStorage storage) throws IOException
getContentBytes in class HoodieLogBlockIOExceptionpublic String getKeyFieldName()
public boolean containsPartialUpdates()
protected static org.apache.avro.Schema getWriterSchema(Map<HoodieLogBlock.HeaderMetadataType,String> logBlockHeader)
public final <T> ClosableIterator<HoodieRecord<T>> getRecordIterator(HoodieRecord.HoodieRecordType type)
public org.apache.avro.Schema getSchema()
public final <T> ClosableIterator<HoodieRecord<T>> getRecordIterator(List<String> keys, boolean fullKey, HoodieRecord.HoodieRecordType type) throws IOException
keys - keys of interest.IOException - in case of failures encountered when reading/parsing recordspublic final <T> ClosableIterator<T> getEngineRecordIterator(HoodieReaderContext<T> readerContext)
T - The type of engine-specific record representation to return.readerContext - HoodieReaderContext instance with type T.public final <T> ClosableIterator<T> getEngineRecordIterator(HoodieReaderContext<T> readerContext, List<String> keys, boolean fullKey)
T - The type of engine-specific record representation to return.readerContext - HoodieReaderContext instance with type T.keys - Keys of interest.fullKey - Whether the key is full or not.protected <T> ClosableIterator<HoodieRecord<T>> readRecordsFromBlockPayload(HoodieRecord.HoodieRecordType type) throws IOException
IOExceptionprotected <T> ClosableIterator<T> readRecordsFromBlockPayload(HoodieReaderContext<T> readerContext) throws IOException
IOExceptionprotected <T> ClosableIterator<HoodieRecord<T>> lookupRecords(List<String> keys, boolean fullKey) throws IOException
IOExceptionprotected abstract byte[] serializeRecords(List<HoodieRecord> records, HoodieStorage storage) throws IOException
IOExceptionprotected abstract <T> ClosableIterator<HoodieRecord<T>> deserializeRecords(byte[] content, HoodieRecord.HoodieRecordType type) throws IOException
IOExceptionprotected abstract <T> ClosableIterator<T> deserializeRecords(HoodieReaderContext<T> readerContext, byte[] content) throws IOException
T - Record type of engine-specific representation.readerContext - Hudi reader context with engine-specific implementation.content - Content in byte array.ClosableIterator of records in engine-specific representation.IOException - upon deserialization error.public abstract HoodieLogBlock.HoodieLogBlockType getBlockType()
getBlockType in class HoodieLogBlockprotected Option<org.apache.avro.Schema.Field> getKeyField(org.apache.avro.Schema schema)
protected Option<String> getRecordKey(HoodieRecord record)
protected org.apache.avro.Schema getSchemaFromHeader()
Copyright © 2024 The Apache Software Foundation. All rights reserved.