vamsikarnika commented on code in PR #639: URL: https://github.com/apache/incubator-xtable/pull/639#discussion_r1951078773
########## xtable-core/src/main/java/org/apache/xtable/hudi/HudiPartitionSyncTool.java: ########## @@ -0,0 +1,466 @@ +/* + * 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.xtable.hudi; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import lombok.extern.log4j.Log4j2; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.Path; + +import org.apache.hudi.common.engine.HoodieLocalEngineContext; +import org.apache.hudi.common.fs.FSUtils; +import org.apache.hudi.common.table.HoodieTableMetaClient; +import org.apache.hudi.common.table.timeline.HoodieInstant; +import org.apache.hudi.common.table.timeline.HoodieTimeline; +import org.apache.hudi.common.table.timeline.TimelineUtils; +import org.apache.hudi.common.util.Option; +import org.apache.hudi.common.util.VisibleForTesting; +import org.apache.hudi.hadoop.CachingPath; +import org.apache.hudi.sync.common.model.PartitionValueExtractor; + +import org.apache.xtable.catalog.CatalogPartitionSyncOperations; +import org.apache.xtable.catalog.Partition; +import org.apache.xtable.catalog.PartitionEvent; +import org.apache.xtable.catalog.PartitionSyncTool; +import org.apache.xtable.exception.CatalogSyncException; +import org.apache.xtable.model.InternalTable; +import org.apache.xtable.model.catalog.CatalogTableIdentifier; + +@Log4j2 +public class HudiPartitionSyncTool implements PartitionSyncTool { + + private final CatalogPartitionSyncOperations catalogClient; + private final HudiTableManager hudiTableManager; + private final PartitionValueExtractor partitionValuesExtractor; + private final Configuration configuration; + + public static final String LAST_COMMIT_TIME_SYNC = "last_commit_time_sync"; + public static final String LAST_COMMIT_COMPLETION_TIME_SYNC = "last_commit_completion_time_sync"; + + public HudiPartitionSyncTool( + CatalogPartitionSyncOperations catalogClient, + PartitionValueExtractor partitionValueExtractor, + Configuration configuration) { + this.catalogClient = catalogClient; + this.hudiTableManager = HudiTableManager.of(configuration); + this.partitionValuesExtractor = partitionValueExtractor; + this.configuration = configuration; + } + + @VisibleForTesting + HudiPartitionSyncTool( + CatalogPartitionSyncOperations catalogClient, + HudiTableManager hudiTableManager, + PartitionValueExtractor partitionValueExtractor, Review Comment: PartitionValueExtractor interface from `hudi-sync-common` package is used to fetch partitions based on the storage path. -- 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]
