wg1026688210 commented on code in PR #2858: URL: https://github.com/apache/paimon/pull/2858#discussion_r1595040964
########## paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/CombinedUmawareCompactionWorkerOperator.java: ########## @@ -0,0 +1,158 @@ +/* + * 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.paimon.flink.sink; + +import org.apache.paimon.annotation.VisibleForTesting; +import org.apache.paimon.append.AppendOnlyCompactionTask; +import org.apache.paimon.catalog.Catalog; +import org.apache.paimon.catalog.Identifier; +import org.apache.paimon.flink.compact.UnwareBucketCompactionHelper; +import org.apache.paimon.flink.source.operator.CombinedBatchUnawareSourceFunction; +import org.apache.paimon.flink.source.operator.CombinedStreamingUnawareSourceFunction; +import org.apache.paimon.options.Options; +import org.apache.paimon.table.FileStoreTable; +import org.apache.paimon.table.sink.CommitMessage; +import org.apache.paimon.utils.ExecutorThreadFactory; + +import org.apache.paimon.shade.guava30.com.google.common.collect.Lists; + +import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * Operator to execute {@link AppendOnlyCompactionTask} passed from {@link + * CombinedStreamingUnawareSourceFunction} or{@link CombinedBatchUnawareSourceFunction} for support + * compacting multi unaware bucket tables in combined mode. + */ +public class CombinedUmawareCompactionWorkerOperator + extends PrepareCommitOperator<AppendOnlyCompactionTask, MultiTableCommittable> { + + private static final Logger LOG = + LoggerFactory.getLogger(CombinedUmawareCompactionWorkerOperator.class); + + private final String commitUser; + private final Catalog.Loader catalogLoader; + + // support multi table compaction + private transient Map<Identifier, UnwareBucketCompactionHelper> compactionHelperContainer; + + private transient ExecutorService lazyCompactExecutor; + + private transient Catalog catalog; + + public CombinedUmawareCompactionWorkerOperator( + Catalog.Loader catalogLoader, String commitUser, Options options) { + super(options); + this.commitUser = commitUser; + this.catalogLoader = catalogLoader; + } + + @VisibleForTesting + Iterable<Future<CommitMessage>> result() { Review Comment: this has been finished at https://github.com/apache/paimon/pull/3175 -- 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]
