From d8d5d392a7a47992bbd9fee564f4d0ffdbff4a09 Mon Sep 17 00:00:00 2001 From: fuchanghai <33984497+fuchanghai@users.noreply.github.com> Date: Sat, 20 Aug 2022 08:25:53 +0800 Subject: [PATCH] [feature-11408] add hive option (#11493) --- .../dolphinscheduler/plugin/task/datax/DataxTask.java | 2 +- .../plugin/task/datax/DataxUtils.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java index 43a6a7e696..08a8c8acc8 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java @@ -565,7 +565,7 @@ public class DataxTask extends AbstractTaskExecutor { int num = md.getColumnCount(); columnNames = new String[num]; for (int i = 1; i <= num; i++) { - columnNames[i - 1] = md.getColumnName(i); + columnNames[i - 1] = md.getColumnName(i).replaceAll("t.",""); } } catch (SQLException | ExecutionException e) { logger.error(e.getMessage(), e); diff --git a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java index 42ba975272..cf39b87ea7 100644 --- a/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java +++ b/dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java @@ -20,6 +20,7 @@ package org.apache.dolphinscheduler.plugin.task.datax; import org.apache.dolphinscheduler.spi.enums.DbType; import com.alibaba.druid.sql.dialect.clickhouse.parser.ClickhouseStatementParser; +import com.alibaba.druid.sql.dialect.hive.parser.HiveStatementParser; import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser; import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; import com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser; @@ -38,6 +39,8 @@ public class DataxUtils { public static final String DATAX_READER_PLUGIN_CLICKHOUSE = "clickhousereader"; + public static final String DATAX_READER_PLUGIN_HIVE = "rdbmsreader"; + public static final String DATAX_WRITER_PLUGIN_MYSQL = "mysqlwriter"; public static final String DATAX_WRITER_PLUGIN_POSTGRESQL = "postgresqlwriter"; @@ -48,6 +51,8 @@ public class DataxUtils { public static final String DATAX_WRITER_PLUGIN_CLICKHOUSE = "clickhousewriter"; + public static final String DATAX_WRITER_PLUGIN_HIVE = "rdbmswriter"; + public static String getReaderPluginName(DbType dbType) { switch (dbType) { case MYSQL: @@ -60,6 +65,8 @@ public class DataxUtils { return DATAX_READER_PLUGIN_SQLSERVER; case CLICKHOUSE: return DATAX_READER_PLUGIN_CLICKHOUSE; + case HIVE: + return DATAX_READER_PLUGIN_HIVE; default: return null; } @@ -77,6 +84,8 @@ public class DataxUtils { return DATAX_WRITER_PLUGIN_SQLSERVER; case CLICKHOUSE: return DATAX_WRITER_PLUGIN_CLICKHOUSE; + case HIVE: + return DATAX_WRITER_PLUGIN_HIVE; default: return null; } @@ -94,6 +103,8 @@ public class DataxUtils { return new SQLServerStatementParser(sql); case CLICKHOUSE: return new ClickhouseStatementParser(sql); + case HIVE: + return new HiveStatementParser(sql); default: return null; }