cshuo commented on code in PR #19118:
URL: https://github.com/apache/hudi/pull/19118#discussion_r3526949232
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/FlinkRowDataReaderContext.java:
##########
@@ -98,24 +101,39 @@ public ClosableIterator<RowData> getFileRecordIterator(
HoodieSchema dataSchema,
HoodieSchema requiredSchema,
HoodieStorage storage) throws IOException {
- boolean isLogFile = FSUtils.isLogFile(filePath);
// disable schema evolution in fileReader if it's log file, since schema
evolution for log file is handled in `FileGroupRecordBuffer`
- InternalSchemaManager schemaManager = isLogFile ?
InternalSchemaManager.DISABLED : internalSchemaManager.get();
+ InternalSchemaManager schemaManager = FSUtils.isLogFile(filePath) ?
InternalSchemaManager.DISABLED : internalSchemaManager.get();
// Log files only reach this method for parquet data blocks; base files
are resolved by their extension.
// Format-specific handling lives in the readers themselves, so this
method stays format-agnostic.
- HoodieFileFormat format = isLogFile ? HoodieFileFormat.PARQUET :
HoodieFileFormat.fromFileExtension(filePath.getFileExtension());
+ boolean isInlineLogFile = FSUtils.isLogFile(filePath) &&
FSUtils.matchNativeLogFile(filePath.getName()).isEmpty();
+ HoodieFileFormat format = isInlineLogFile ? HoodieFileFormat.PARQUET :
HoodieFileFormat.fromFileExtension(filePath.getFileExtension());
HoodieRowDataFileReader reader = (HoodieRowDataFileReader)
HoodieIOFactory.getIOFactory(storage)
.getReaderFactory(HoodieRecord.HoodieRecordType.FLINK)
.getFileReader(tableConfig, filePath, format, Option.empty());
try {
- return reader.getRowDataIterator(dataSchema, requiredSchema,
schemaManager, getSafePredicates(requiredSchema));
+ ClosableIterator<RowData> rowDataIterator =
+ reader.getRowDataIterator(dataSchema, requiredSchema, schemaManager,
getSafePredicates(requiredSchema));
+ return resolveRowKind(rowDataIterator, requiredSchema);
} catch (Throwable e) {
reader.close();
throw new HoodieException("Failed to get record iterator for: " +
filePath, e);
}
}
+ private ClosableIterator<RowData> resolveRowKind(ClosableIterator<RowData>
rowDataIterator, HoodieSchema requiredSchema) {
Review Comment:
Confirmed, `resolveRowKind()` also fixes legacy inline parquet log blocks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]