This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 81cb80c05 [Feature][Connector-V2] Add orc file support in connector
hive sink (#2311) (#2374)
81cb80c05 is described below
commit 81cb80c050a758ae4a333eb7c3d5e250e2e1aed4
Author: TyrantLucifer <[email protected]>
AuthorDate: Sat Aug 6 00:02:57 2022 +0800
[Feature][Connector-V2] Add orc file support in connector hive sink (#2311)
(#2374)
---
.../connectors/seatunnel/hive/sink/HiveSinkConfig.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git
a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSinkConfig.java
b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSinkConfig.java
index 837237b19..b05b8d2e4 100644
---
a/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSinkConfig.java
+++
b/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/sink/HiveSinkConfig.java
@@ -56,6 +56,9 @@ import java.util.stream.Collectors;
@Data
public class HiveSinkConfig implements Serializable {
+ private static final String TEXT_FORMAT_CLASSNAME =
"org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat";
+ private static final String PARQUET_FORMAT_CLASSNAME =
"org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat";
+ private static final String ORC_FORMAT_CLASSNAME =
"org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat";
private String hiveTableName;
private List<String> hivePartitionFieldList;
private String hiveMetaUris;
@@ -94,14 +97,16 @@ public class HiveSinkConfig implements Serializable {
table = hiveMetaStoreClient.getTable(dbName, tableName);
String outputFormat = table.getSd().getOutputFormat();
Map<String, String> parameters =
table.getSd().getSerdeInfo().getParameters();
- if
("org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat".equals(outputFormat))
{
+ if (TEXT_FORMAT_CLASSNAME.equals(outputFormat)) {
config = config.withValue(FILE_FORMAT,
ConfigValueFactory.fromAnyRef(FileFormat.TEXT.toString()))
.withValue(FIELD_DELIMITER,
ConfigValueFactory.fromAnyRef(parameters.get("field.delim")))
.withValue(ROW_DELIMITER,
ConfigValueFactory.fromAnyRef(parameters.get("line.delim")));
- } else if
("org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat".equals(outputFormat))
{
+ } else if (PARQUET_FORMAT_CLASSNAME.equals(outputFormat)) {
config = config.withValue(FILE_FORMAT,
ConfigValueFactory.fromAnyRef(FileFormat.PARQUET.toString()));
+ } else if (ORC_FORMAT_CLASSNAME.equals(outputFormat)) {
+ config = config.withValue(FILE_FORMAT,
ConfigValueFactory.fromAnyRef(FileFormat.ORC.toString()));
} else {
- throw new RuntimeException("Only support text or parquet file
now");
+ throw new RuntimeException("Only support [text parquet orc]
file now");
}
config = config.withValue(IS_PARTITION_FIELD_WRITE_IN_FILE,
ConfigValueFactory.fromAnyRef(false))