-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Connector-V2] Add File Sink Connector (#2117)
* tmp commit * add hadoop2 and hadoop3 shade jar * add hadoop2 and hadoop3 shade jar * add license head * change know denpendencies * tmp commit * tmp commit * change hadoop dependency scope to provide * back pom * fix checkstyle * add example * fix example bug * remove file connector from example and e2e because hadoop2 can not compile with jdk11 * no need jdk8 and jdk11 profile because we don't use hadoop shade jar * change hadoop jar dependency scope to provided * back * file connector can not build in jdk11 * drop hadoop shade * add gitignore item * add hadoop and local file sink * fix pom error * fix pom error * fix pom error * implement new interface * fix UT error * fix e2e error * update build timeout from 30min to 40min * fix e2e error * remove auto service * fix e2e error * fix e2e error * fix e2e error * found e2e error * fix e2e error * fix e2e error * fix e2e error * merge from upstream * merge from upstream * merge from upstream * merge from upstream * merge from upstream * add mvn jvm option * add mvn jvm option * add license * add licnese * add licnese * fix dependency * fix build jvm oom * fix build jvm oom * fix build jvm oom * fix dependency * fix dependency * fix e2e error * add codeql check timeout from 30min to 60min * merge from dev * merge from dev * fix ci error * fix checkstyle * fix ci * fix ci * aa * aa * aa * add .idea * del .idea * del .idea * del .idea * del .idea * remove no use license * remove no use before and after method in test * fix license; remove dependency * fix review * fix build order * fix license * fix license * fix review * fix review * fix review * fix review * fix review * fix review * fix review * fix review * fix review * add code-analysys timeout to 120 * retry ci * update license and remove no use jar from LICENSE file * retry ci Co-authored-by: Hisoka <fanjiaeminem@qq.com>
- Loading branch information
1 parent
59ce8a2
commit e2283da
Showing
80 changed files
with
3,818 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
seatunnel-connectors-v2/connector-file/connector-file-base/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>connector-file</artifactId> | ||
<groupId>org.apache.seatunnel</groupId> | ||
<version>${revision}</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>connector-file-base</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.seatunnel</groupId> | ||
<artifactId>seatunnel-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.seatunnel</groupId> | ||
<artifactId>seatunnel-core-base</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-collections4</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.powermock</groupId> | ||
<artifactId>powermock-module-junit4</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.powermock</groupId> | ||
<artifactId>powermock-api-mockito2</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
75 changes: 75 additions & 0 deletions
75
...in/java/org/apache/seatunnel/connectors/seatunnel/file/config/AbstractTextFileConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* 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.config; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
import org.apache.seatunnel.shade.com.typesafe.config.Config; | ||
|
||
import lombok.Data; | ||
import lombok.NonNull; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.io.Serializable; | ||
import java.util.Locale; | ||
|
||
@Data | ||
public class AbstractTextFileConfig implements DelimiterConfig, CompressConfig, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
protected String compressCodec; | ||
|
||
protected String fieldDelimiter = String.valueOf('\001'); | ||
|
||
protected String rowDelimiter = "\n"; | ||
|
||
protected String path; | ||
protected String fileNameExpression; | ||
protected FileFormat fileFormat = FileFormat.TEXT; | ||
|
||
public AbstractTextFileConfig(@NonNull Config config) { | ||
checkNotNull(config.getString(Constant.PATH)); | ||
|
||
if (config.hasPath(Constant.COMPRESS_CODEC)) { | ||
throw new RuntimeException("compress not support now"); | ||
} | ||
|
||
if (config.hasPath(Constant.FIELD_DELIMITER) && !StringUtils.isBlank(config.getString(Constant.FIELD_DELIMITER))) { | ||
this.fieldDelimiter = config.getString(Constant.FIELD_DELIMITER); | ||
} | ||
|
||
if (config.hasPath(Constant.ROW_DELIMITER) && !StringUtils.isBlank(config.getString(Constant.ROW_DELIMITER))) { | ||
this.rowDelimiter = config.getString(Constant.ROW_DELIMITER); | ||
} | ||
|
||
if (config.hasPath(Constant.PATH) && !StringUtils.isBlank(config.getString(Constant.PATH))) { | ||
this.path = config.getString(Constant.PATH); | ||
} | ||
|
||
if (config.hasPath(Constant.FILE_NAME_EXPRESSION) && !StringUtils.isBlank(config.getString(Constant.FILE_NAME_EXPRESSION))) { | ||
this.fileNameExpression = config.getString(Constant.FILE_NAME_EXPRESSION); | ||
} | ||
|
||
if (config.hasPath(Constant.FILE_FORMAT) && !StringUtils.isBlank(config.getString(Constant.FILE_FORMAT))) { | ||
this.fileFormat = FileFormat.valueOf(config.getString(Constant.FILE_FORMAT).toUpperCase(Locale.ROOT)); | ||
} | ||
} | ||
|
||
protected AbstractTextFileConfig() { | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...e/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/CompressConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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.config; | ||
|
||
public interface CompressConfig { | ||
String getCompressCodec(); | ||
} |
41 changes: 41 additions & 0 deletions
41
...le-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/Constant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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.config; | ||
|
||
public class Constant { | ||
public static final String SEATUNNEL = "seatunnel"; | ||
public static final String NON_PARTITION = "NON_PARTITION"; | ||
public static final String TRANSACTION_ID_SPLIT = "_"; | ||
public static final String TRANSACTION_EXPRESSION = "transactionId"; | ||
|
||
public static final String SAVE_MODE = "save_mode"; | ||
public static final String COMPRESS_CODEC = "compress_codec"; | ||
|
||
public static final String PATH = "path"; | ||
public static final String FIELD_DELIMITER = "field_delimiter"; | ||
public static final String ROW_DELIMITER = "row_delimiter"; | ||
public static final String PARTITION_BY = "partition_by"; | ||
public static final String PARTITION_DIR_EXPRESSION = "partition_dir_expression"; | ||
public static final String IS_PARTITION_FIELD_WRITE_IN_FILE = "is_partition_field_write_in_file"; | ||
public static final String TMP_PATH = "tmp_path"; | ||
public static final String FILE_NAME_EXPRESSION = "file_name_expression"; | ||
public static final String FILE_FORMAT = "file_format"; | ||
public static final String SINK_COLUMNS = "sink_columns"; | ||
public static final String FILENAME_TIME_FORMAT = "filename_time_format"; | ||
public static final String IS_ENABLE_TRANSACTION = "is_enable_transaction"; | ||
} |
24 changes: 24 additions & 0 deletions
24
.../src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/DelimiterConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* 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.config; | ||
|
||
public interface DelimiterConfig { | ||
String getFieldDelimiter(); | ||
|
||
String getRowDelimiter(); | ||
} |
Oops, something went wrong.