nsivabalan commented on code in PR #12313: URL: https://github.com/apache/hudi/pull/12313#discussion_r1853068420
########## hudi-common/src/main/java/org/apache/hudi/metadata/BaseFileRecordParsingUtils.java: ########## @@ -0,0 +1,127 @@ +/* + * 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.metadata; + +import org.apache.hudi.common.fs.FSUtils; +import org.apache.hudi.common.model.HoodieFileFormat; +import org.apache.hudi.common.model.HoodieRecord; +import org.apache.hudi.common.model.HoodieWriteStat; +import org.apache.hudi.common.util.FileFormatUtils; +import org.apache.hudi.common.util.StringUtils; +import org.apache.hudi.io.storage.HoodieIOFactory; +import org.apache.hudi.storage.HoodieStorage; +import org.apache.hudi.storage.StoragePath; + +import org.apache.hadoop.fs.Path; + +import java.io.IOException; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import static java.util.stream.Collectors.toList; + +public class BaseFileRecordParsingUtils { + + /** + * Generates RLI Metadata records for base files. + * If base file is a added to a new file group, all record keys are treated as inserts. + * If a base file is added to an existing file group, we read previous base file in addition to the latest base file of interest. Find deleted records and generate RLI Metadata records + * for the same in addition to new insert records. + * @param basePath base path of the table. + * @param writeStat {@link HoodieWriteStat} of interest. + * @param writesFileIdEncoding fileID encoding for the table. + * @param instantTime instant time of interest. + * @param storage instance of {@link HoodieStorage}. + * @return Iterator of {@link HoodieRecord}s for RLI Metadata partition. + * @throws IOException + */ + public static Iterator<HoodieRecord> generateRLIMetadataHoodieRecordsForBaseFile(String basePath, Review Comment: yes. we already have it for the RLI methods. I will be updating the patch w/ more tests for the rest (SI related ones). -- 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]
