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 InternalSchema |
internalSchema |
protected org.apache.avro.Schema |
readerSchema |
readBlockLazily, version| Modifier | Constructor and Description |
|---|---|
|
HoodieDataBlock(List<org.apache.avro.generic.IndexedRecord> records,
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,
org.apache.hadoop.fs.FSDataInputStream inputStream,
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)
|
protected |
HoodieDataBlock(Option<byte[]> content,
org.apache.hadoop.fs.FSDataInputStream inputStream,
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,
InternalSchema internalSchema) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract ClosableIterator<org.apache.avro.generic.IndexedRecord> |
deserializeRecords(byte[] content) |
abstract HoodieLogBlock.HoodieLogBlockType |
getBlockType() |
byte[] |
getContentBytes() |
protected Option<org.apache.avro.Schema.Field> |
getKeyField(org.apache.avro.Schema schema) |
ClosableIterator<org.apache.avro.generic.IndexedRecord> |
getRecordIterator()
Returns all the records iterator contained w/in this block.
|
ClosableIterator<org.apache.avro.generic.IndexedRecord> |
getRecordIterator(List<String> keys,
boolean fullKey)
Batch get of keys of interest.
|
protected Option<String> |
getRecordKey(org.apache.avro.generic.IndexedRecord record) |
org.apache.avro.Schema |
getSchema() |
protected static org.apache.avro.Schema |
getWriterSchema(Map<HoodieLogBlock.HeaderMetadataType,String> logBlockHeader) |
protected ClosableIterator<org.apache.avro.generic.IndexedRecord> |
lookupRecords(List<String> keys,
boolean fullKey) |
protected ClosableIterator<org.apache.avro.generic.IndexedRecord> |
readRecordsFromBlockPayload() |
protected abstract byte[] |
serializeRecords(List<org.apache.avro.generic.IndexedRecord> records) |
deflate, getBlockContentLocation, getContent, getLogBlockFooter, getLogBlockHeader, getLogBlockLength, getLogMetadata, getLogMetadataBytes, getMagic, inflate, tryReadContentprotected final org.apache.avro.Schema readerSchema
protected InternalSchema internalSchema
public HoodieDataBlock(List<org.apache.avro.generic.IndexedRecord> records, Map<HoodieLogBlock.HeaderMetadataType,String> header, Map<HoodieLogBlock.HeaderMetadataType,String> footer, String keyFieldName)
protected HoodieDataBlock(Option<byte[]> content, org.apache.hadoop.fs.FSDataInputStream inputStream, 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)
protected HoodieDataBlock(Option<byte[]> content, org.apache.hadoop.fs.FSDataInputStream inputStream, 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, InternalSchema internalSchema)
public byte[] getContentBytes()
throws IOException
getContentBytes in class HoodieLogBlockIOExceptionprotected static org.apache.avro.Schema getWriterSchema(Map<HoodieLogBlock.HeaderMetadataType,String> logBlockHeader)
public final ClosableIterator<org.apache.avro.generic.IndexedRecord> getRecordIterator()
public org.apache.avro.Schema getSchema()
public final ClosableIterator<org.apache.avro.generic.IndexedRecord> getRecordIterator(List<String> keys, boolean fullKey) throws IOException
keys - keys of interest.IOException - in case of failures encountered when reading/parsing recordsprotected ClosableIterator<org.apache.avro.generic.IndexedRecord> readRecordsFromBlockPayload() throws IOException
IOExceptionprotected ClosableIterator<org.apache.avro.generic.IndexedRecord> lookupRecords(List<String> keys, boolean fullKey) throws IOException
IOExceptionprotected abstract byte[] serializeRecords(List<org.apache.avro.generic.IndexedRecord> records) throws IOException
IOExceptionprotected abstract ClosableIterator<org.apache.avro.generic.IndexedRecord> deserializeRecords(byte[] content) throws IOException
IOExceptionpublic abstract HoodieLogBlock.HoodieLogBlockType getBlockType()
getBlockType in class HoodieLogBlockprotected Option<org.apache.avro.Schema.Field> getKeyField(org.apache.avro.Schema schema)
Copyright © 2022 The Apache Software Foundation. All rights reserved.