You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/07/27 06:53:11 UTC

[GitHub] [incubator-seatunnel] TyrantLucifer commented on a diff in pull request #2273: [Connector-V2] Add parquet writer in file connector

TyrantLucifer commented on code in PR #2273:
URL: https://github.com/apache/incubator-seatunnel/pull/2273#discussion_r930683978


##########
seatunnel-connectors-v2/connector-file/connector-file-local/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/local/LocalTransactionStateFileWriteFactory.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.file.sink.local;
+
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.file.config.FileFormat;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.spi.FileSystem;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.transaction.TransactionFileNameGenerator;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.transaction.TransactionStateFileWriter;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.writer.FileSinkTransactionFileNameGenerator;
+import org.apache.seatunnel.connectors.seatunnel.file.sink.writer.PartitionDirNameGenerator;
+
+import lombok.NonNull;
+
+import java.util.List;
+
+public class LocalTransactionStateFileWriteFactory {
+
+    private LocalTransactionStateFileWriteFactory() {}
+
+    public static TransactionStateFileWriter of(@NonNull SeaTunnelRowType seaTunnelRowTypeInfo,
+                                                @NonNull TransactionFileNameGenerator transactionFileNameGenerator,
+                                                @NonNull PartitionDirNameGenerator partitionDirNameGenerator,
+                                                @NonNull List<Integer> sinkColumnsIndexInRow,
+                                                @NonNull String tmpPath,
+                                                @NonNull String targetPath,
+                                                @NonNull String jobId,
+                                                int subTaskIndex,
+                                                @NonNull String fieldDelimiter,
+                                                @NonNull String rowDelimiter,
+                                                @NonNull FileSystem fileSystem) {
+        FileSinkTransactionFileNameGenerator fileSinkTransactionFileNameGenerator = (FileSinkTransactionFileNameGenerator) transactionFileNameGenerator;
+        FileFormat fileFormat = fileSinkTransactionFileNameGenerator.getFileFormat();
+        if (fileFormat.equals(FileFormat.CSV)) {
+            // #2133 wait this issue closed, there will be replaced using csv writer
+            return new LocalTxtTransactionStateFileWriter(
+                    seaTunnelRowTypeInfo,
+                    transactionFileNameGenerator,
+                    partitionDirNameGenerator,
+                    sinkColumnsIndexInRow,
+                    tmpPath,
+                    targetPath,
+                    jobId,
+                    subTaskIndex,
+                    fieldDelimiter,
+                    rowDelimiter,
+                    fileSystem);
+        } else if (fileFormat.equals(FileFormat.PARQUET)) {

Review Comment:
   done



-- 
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@seatunnel.apache.org

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