You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "GanfengTan (via GitHub)" <gi...@apache.org> on 2023/04/11 08:04:54 UTC

[GitHub] [inlong] GanfengTan commented on a diff in pull request #7791: [Improve][Sort] Add Presort to reduce discrete partitions when ingesting data into iceberg

GanfengTan commented on code in PR #7791:
URL: https://github.com/apache/inlong/pull/7791#discussion_r1162433301


##########
inlong-sort/sort-connectors/iceberg/src/main/java/org/apache/inlong/sort/iceberg/sink/GroupedPartitionedDeltaWriter.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.inlong.sort.iceberg.sink;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.iceberg.FileFormat;
+import org.apache.iceberg.PartitionKey;
+import org.apache.iceberg.PartitionSpec;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.io.FileAppenderFactory;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.io.OutputFileFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy;
+import java.util.concurrent.TimeUnit;
+
+public class GroupedPartitionedDeltaWriter extends org.apache.inlong.sort.iceberg.sink.trick.BaseDeltaTaskWriter {
+
+    private static final Logger LOG = LoggerFactory.getLogger(GroupedPartitionedDeltaWriter.class);
+
+    private static final ExecutorService CLOSE_EXECUTOR_SERVICE = new ThreadPoolExecutor(
+            10,
+            20,
+            100L,
+            TimeUnit.MILLISECONDS,
+            new LinkedBlockingQueue<>(100),
+            new ThreadFactoryBuilder().setNameFormat("iceberg-writer-close-thread-%s").build(),
+            new CallerRunsPolicy());
+

Review Comment:
   This definition specifies whether the size of all variables is appropriate for the user.



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org