lokeshj1703 commented on code in PR #13286: URL: https://github.com/apache/hudi/pull/13286#discussion_r2135850904
########## hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/MetadataIndexGenerator.java: ########## @@ -0,0 +1,118 @@ +/* + * 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.client.WriteStatus; +import org.apache.hudi.common.function.SerializableFunction; +import org.apache.hudi.common.model.HoodieRecord; +import org.apache.hudi.common.model.HoodieRecordDelegate; +import org.apache.hudi.common.model.HoodieRecordLocation; +import org.apache.hudi.common.util.Option; +import org.apache.hudi.config.HoodieWriteConfig; +import org.apache.hudi.exception.HoodieMetadataException; +import org.apache.hudi.storage.StorageConfiguration; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import static org.apache.hudi.metadata.MetadataPartitionType.RECORD_INDEX; + +/** + * For now this is a placeholder to generate all MDT records in one place. + * Once https://github.com/apache/hudi/pull/13226 is landed, we will leverage the new abstraction to generate MDT records. + */ +public class MetadataIndexGenerator implements Serializable { + + private static final Logger LOG = LoggerFactory.getLogger(MetadataIndexGenerator.class); + + /** + * MDT record generation utility. This function is expected to be invoked from a map Partition call, where one spark task will receive + * one WriteStatus as input and the output contains prepared Metadata table records for all eligible partitions that can operate on one + * WriteStatus instance only. + */ + static class WriteStatusBasedMetadataIndexGenerator implements SerializableFunction<WriteStatus, Iterator<HoodieRecord>> { + List<MetadataPartitionType> enabledPartitionTypes; + HoodieWriteConfig dataWriteConfig; + StorageConfiguration<?> storageConf; + String instantTime; Review Comment: Addressed -- 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]
