public class HoodieMergeOnReadSnapshotReader extends AbstractRealtimeRecordReader implements Iterator<HoodieRecord>, AutoCloseable
AbstractRealtimeRecordReader that reads from base parquet files and log files,
and merges the records on the fly. It differs from HoodieRealtimeRecordReader in that it does not
implement Hadoop's RecordReader interface, and instead implements Iterator interface that returns an iterator
of HoodieRecords which are HoodieAvroIndexedRecords. This can be used by query engines like
Trino that do not use Hadoop's RecordReader interface. However, the engine must support reading from iterators
and also support Avro (de)serialization.payloadProps, schemaEvolutionContext, serializer, split, supportPayload, usesCustomPayload| Constructor and Description |
|---|
HoodieMergeOnReadSnapshotReader(String tableBasePath,
String baseFilePath,
List<HoodieLogFile> logFilePaths,
String latestInstantTime,
org.apache.avro.Schema readerSchema,
org.apache.hadoop.mapred.JobConf jobConf,
long start,
long length)
In order to instantiate this record reader, one needs to provide following parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Map<String,HoodieRecord> |
getLogRecordsByKey() |
Map<String,HoodieRecord> |
getRecordsByKey() |
Iterator<HoodieRecord> |
getRecordsIterator() |
boolean |
hasNext() |
HoodieRecord |
next() |
constructHiveOrderedSchema, getHiveSchema, getJobConf, getLogScannerReaderSchema, getReaderSchema, getSplit, getWriterSchema, isSupportTimestamp, setHiveSchema, setReaderSchema, setWriterSchemaclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemaining, removepublic HoodieMergeOnReadSnapshotReader(String tableBasePath, String baseFilePath, List<HoodieLogFile> logFilePaths, String latestInstantTime, org.apache.avro.Schema readerSchema, org.apache.hadoop.mapred.JobConf jobConf, long start, long length) throws IOException
tableBasePath - Base path of the Hudi tablebaseFilePath - Path of the base file as of the latest instant time for the split being processedlogFilePaths - Paths of the log files as of the latest file slices pertaining to file group id of the base filelatestInstantTime - Latest instant timereaderSchema - Schema of the readerjobConf - Any job configurationstart - Start offsetlength - Length of the splitIOExceptionpublic boolean hasNext()
hasNext in interface Iterator<HoodieRecord>public HoodieRecord next()
next in interface Iterator<HoodieRecord>public Map<String,HoodieRecord> getRecordsByKey()
public Iterator<HoodieRecord> getRecordsIterator()
public Map<String,HoodieRecord> getLogRecordsByKey()
public void close()
throws Exception
close in interface AutoCloseableExceptionCopyright © 2024 The Apache Software Foundation. All rights reserved.