This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new fd739d541fe [HUDI-7058] Check if option is empty before get in
HoodieBaseFileGroupRecordBuffer (#10027)
fd739d541fe is described below
commit fd739d541feadbb5b7d9f3a990b15fd447de589b
Author: Jon Vexler <[email protected]>
AuthorDate: Thu Nov 9 06:38:28 2023 -0500
[HUDI-7058] Check if option is empty before get in
HoodieBaseFileGroupRecordBuffer (#10027)
Co-authored-by: Jonathan Vexler <=>
---
.../common/table/read/HoodieBaseFileGroupRecordBuffer.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git
a/hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieBaseFileGroupRecordBuffer.java
b/hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieBaseFileGroupRecordBuffer.java
index b56885fb0d3..06053293adf 100644
---
a/hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieBaseFileGroupRecordBuffer.java
+++
b/hudi-common/src/main/java/org/apache/hudi/common/table/read/HoodieBaseFileGroupRecordBuffer.java
@@ -125,7 +125,7 @@ public abstract class HoodieBaseFileGroupRecordBuffer<T>
implements HoodieFileGr
// Merge and store the combined record
// Note that the incoming `record` is from an older commit, so it should
be put as
// the `older` in the merge API
- Pair<HoodieRecord, Schema> combinedRecordAndSchema = enablePartialMerging
+ Option<Pair<HoodieRecord, Schema>> combinedRecordAndSchemaOpt =
enablePartialMerging
? recordMerger.partialMerge(
readerContext.constructHoodieRecord(Option.of(record), metadata),
(Schema) metadata.get(INTERNAL_META_SCHEMA),
@@ -133,15 +133,20 @@ public abstract class HoodieBaseFileGroupRecordBuffer<T>
implements HoodieFileGr
existingRecordMetadataPair.getLeft(),
existingRecordMetadataPair.getRight()),
(Schema)
existingRecordMetadataPair.getRight().get(INTERNAL_META_SCHEMA),
readerSchema,
- payloadProps).get()
+ payloadProps)
: recordMerger.merge(
readerContext.constructHoodieRecord(Option.of(record), metadata),
(Schema) metadata.get(INTERNAL_META_SCHEMA),
readerContext.constructHoodieRecord(
existingRecordMetadataPair.getLeft(),
existingRecordMetadataPair.getRight()),
(Schema)
existingRecordMetadataPair.getRight().get(INTERNAL_META_SCHEMA),
- payloadProps).get();
+ payloadProps);
+ if (!combinedRecordAndSchemaOpt.isPresent()) {
+ return Option.empty();
+ }
+
+ Pair<HoodieRecord, Schema> combinedRecordAndSchema =
combinedRecordAndSchemaOpt.get();
HoodieRecord<T> combinedRecord = combinedRecordAndSchema.getLeft();
// If pre-combine returns existing record, no need to update it