nsivabalan commented on code in PR #13670:
URL: https://github.com/apache/hudi/pull/13670#discussion_r2250160569


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/buffer/RecordsBasedFileGroupRecordBufferLoader.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.common.table.read.buffer;
+
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.engine.HoodieReaderContext;
+import org.apache.hudi.common.table.HoodieTableMetaClient;
+import org.apache.hudi.common.table.read.BaseFileUpdateCallback;
+import org.apache.hudi.common.table.read.BufferedRecord;
+import org.apache.hudi.common.table.read.HoodieReadStats;
+import org.apache.hudi.common.table.read.InputSplit;
+import org.apache.hudi.common.table.read.ReaderParameters;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.common.util.collection.Pair;
+import org.apache.hudi.exception.HoodieIOException;
+import org.apache.hudi.storage.HoodieStorage;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Records based {@link FileGroupRecordBuffer} which takes in a map of records 
to be merged with a base file of interest.
+ * This will be used in write paths for COW merge cases.
+ * @param <T> Engine native presentation of the record.
+ */
+public class RecordsBasedFileGroupRecordBufferLoader<T> extends 
DefaultFileGroupRecordBufferLoader<T> {
+
+  private final Map<Serializable, BufferedRecord<T>> toBeMergedRecords;
+
+  private RecordsBasedFileGroupRecordBufferLoader(Map<Serializable, 
BufferedRecord<T>> toBeMergedRecords) {
+    super();
+    this.toBeMergedRecords = toBeMergedRecords;

Review Comment:
   I thought about this before raising the patch on friday. 
   we have input which stems from HoodieWriteHandle. 
   we have the sink externalSpillableMap here which is within the record 
buffer. 
   
   We won't be able to fix the sink here, since we plan to leverage 
`processNextDataBlock`.
   so only option is to fix the input. 
   As of now, its within HoodieWriteHandle (base class) which receives an 
iterator of records and fills in the `keyToNewRecords` 
https://github.com/apache/hudi/blob/f51c36fd64398718c039b26c15767e793b82904e/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieWriteMergeHandle.java#L214
 
   
   But it should be doable.
   I can take up this fix in my next patch were I migrate the COW merge handle. 
   



-- 
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]

Reply via email to