JingsongLi commented on code in PR #1366:
URL: https://github.com/apache/incubator-paimon/pull/1366#discussion_r1229401359


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/UnawareBucketCompactionSink.java:
##########
@@ -42,6 +42,13 @@ public static DataStreamSink<?> sink(
         return new UnawareBucketCompactionSink(table).sinkFrom(input);
     }
 
+    public static DataStream<Committable> uncommitted(

Review Comment:
   this method is useless... remove it. (it just wrap one line)



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/FlinkSinkBuilder.java:
##########
@@ -102,4 +104,13 @@ private DataStreamSink<?> buildForFixedBucket() {
                 new FileStoreSink(table, lockFactory, overwritePartition, 
logSinkFunction);
         return sink.sinkFrom(partitioned);
     }
+
+    private DataStreamSink<?> buildUnawareBucketSink() {
+        return new UnawareBucketWriteSink(

Review Comment:
   Just inline `UnawareBucketWriteSink` here?



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/FlinkWriteSink.java:
##########
@@ -41,7 +41,15 @@ public FlinkWriteSink(
             FileStoreTable table,
             @Nullable Map<String, String> overwritePartition,
             Lock.Factory lockFactory) {
-        super(table, overwritePartition != null);
+        this(table, overwritePartition, lockFactory, false);
+    }
+
+    public FlinkWriteSink(

Review Comment:
   useless?



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/FileStoreSink.java:
##########
@@ -40,7 +40,16 @@ public FileStoreSink(
             Lock.Factory lockFactory,
             @Nullable Map<String, String> overwritePartition,
             @Nullable LogSinkFunction logSinkFunction) {
-        super(table, overwritePartition, lockFactory);
+        this(table, lockFactory, overwritePartition, logSinkFunction, false);
+    }
+
+    public FileStoreSink(

Review Comment:
   should introduce this?



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/UnawareBucketWriteSink.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.flink.compact.UnawareBucketCompactionTopoBuilder;
+import org.apache.paimon.operation.Lock;
+import org.apache.paimon.table.AppendOnlyFileStoreTable;
+
+import org.apache.flink.api.common.RuntimeExecutionMode;
+import org.apache.flink.configuration.ExecutionOptions;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.datastream.DataStreamSink;
+import org.apache.flink.streaming.api.transformations.PartitionTransformation;
+import org.apache.flink.table.data.RowData;
+
+import javax.annotation.Nullable;
+
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Build topology for unaware bucket table sink.
+ *
+ * <p>Note: in unaware-bucket mode, we don't shuffle by bucket in inserting. 
We can assign
+ * compaction to the inserting jobs aside.
+ */
+public class UnawareBucketWriteSink {
+
+    private final AppendOnlyFileStoreTable table;
+    private final Lock.Factory lockFactory;
+    private final boolean enableCompaction;
+    @Nullable private final Map<String, String> overwritePartitions;
+    private final LogSinkFunction logSinkFunction;
+
+    public UnawareBucketWriteSink(
+            AppendOnlyFileStoreTable table,
+            Lock.Factory lock,
+            Map<String, String> overwritePartitions,
+            LogSinkFunction logSinkFunction) {
+        this.table = table;
+        this.lockFactory = lock;
+        this.enableCompaction = !table.coreOptions().writeOnly();
+        this.overwritePartitions = overwritePartitions;
+        this.logSinkFunction = logSinkFunction;
+    }
+
+    public DataStreamSink<?> build(DataStream<RowData> input, Integer 
parallelism) {
+        String commitUser = UUID.randomUUID().toString();
+        // we set partitioner equals null, if the parallelism we set equals to 
input, we could chain
+        // sink operator and input in one stage
+        PartitionTransformation<RowData> partitioned =
+                new PartitionTransformation<>(input.getTransformation(), null);
+        if (parallelism != null) {
+            partitioned.setParallelism(parallelism);
+        }
+        FileStoreSink sink =
+                new FileStoreSink(table, lockFactory, overwritePartitions, 
logSinkFunction, true);

Review Comment:
   Why just true?



-- 
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]

Reply via email to