Unverified Commit b8550805 authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Optimize] You can submit Yarn-Application (Linux) on Windows (#2541)

* fix_app * fix_web_some_bug * fix_app * fix_app * fix_app * fix_app_some_bug * fix_app_some_bug * fix_app_some_bug
parent 4f6c1c14
...@@ -44,11 +44,6 @@ ...@@ -44,11 +44,6 @@
<groupId>org.jasypt</groupId> <groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId> <artifactId>jasypt</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.12.481</version>
</dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
......
...@@ -26,6 +26,7 @@ import org.dinky.data.exception.BusException; ...@@ -26,6 +26,7 @@ import org.dinky.data.exception.BusException;
import org.dinky.data.model.FlinkUdfManifest; import org.dinky.data.model.FlinkUdfManifest;
import org.dinky.function.constant.PathConstant; import org.dinky.function.constant.PathConstant;
import org.dinky.function.util.ZipWriter; import org.dinky.function.util.ZipWriter;
import org.dinky.service.resource.BaseResourceManager;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
...@@ -50,7 +51,9 @@ import io.swagger.annotations.Api; ...@@ -50,7 +51,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** @since 0.7.0 */ /**
* @since 0.7.0
*/
@Slf4j @Slf4j
@RestController @RestController
@Api(tags = "UDF & App Jar Controller") @Api(tags = "UDF & App Jar Controller")
...@@ -102,7 +105,7 @@ public class DownloadController { ...@@ -102,7 +105,7 @@ public class DownloadController {
* 提供docker通过http下载dinky-app.jar * 提供docker通过http下载dinky-app.jar
* *
* @param version 版本 * @param version 版本
* @param resp resp * @param resp resp
*/ */
@GetMapping("downloadAppJar/{version}") @GetMapping("downloadAppJar/{version}")
@Log(title = "Download App Jar", businessType = BusinessType.DOWNLOAD) @Log(title = "Download App Jar", businessType = BusinessType.DOWNLOAD)
...@@ -114,4 +117,12 @@ public class DownloadController { ...@@ -114,4 +117,12 @@ public class DownloadController {
ServletUtil.write(resp, files.get(0)); ServletUtil.write(resp, files.get(0));
} }
} }
@GetMapping("downloadFromRs")
@Log(title = "Download From Resource", businessType = BusinessType.DOWNLOAD)
@ApiOperation("Download From Resource")
public void downloadJavaUDF(String path, HttpServletResponse resp) {
InputStream inputStream = BaseResourceManager.getInstance().readFile(path);
ServletUtil.write(resp, inputStream);
}
} }
...@@ -34,6 +34,7 @@ import org.dinky.data.properties.OssProperties; ...@@ -34,6 +34,7 @@ import org.dinky.data.properties.OssProperties;
import org.dinky.function.constant.PathConstant; import org.dinky.function.constant.PathConstant;
import org.dinky.function.pool.UdfCodePool; import org.dinky.function.pool.UdfCodePool;
import org.dinky.job.FlinkJobTask; import org.dinky.job.FlinkJobTask;
import org.dinky.oss.OssTemplate;
import org.dinky.scheduler.client.ProjectClient; import org.dinky.scheduler.client.ProjectClient;
import org.dinky.scheduler.exception.SchedulerException; import org.dinky.scheduler.exception.SchedulerException;
import org.dinky.scheduler.model.Project; import org.dinky.scheduler.model.Project;
...@@ -46,7 +47,6 @@ import org.dinky.service.resource.impl.HdfsResourceManager; ...@@ -46,7 +47,6 @@ import org.dinky.service.resource.impl.HdfsResourceManager;
import org.dinky.service.resource.impl.OssResourceManager; import org.dinky.service.resource.impl.OssResourceManager;
import org.dinky.url.RsURLStreamHandlerFactory; import org.dinky.url.RsURLStreamHandlerFactory;
import org.dinky.utils.JsonUtils; import org.dinky.utils.JsonUtils;
import org.dinky.utils.OssTemplate;
import org.dinky.utils.UDFUtils; import org.dinky.utils.UDFUtils;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
...@@ -98,9 +98,9 @@ public class SystemInit implements ApplicationRunner { ...@@ -98,9 +98,9 @@ public class SystemInit implements ApplicationRunner {
public void run(ApplicationArguments args) { public void run(ApplicationArguments args) {
TenantContextHolder.ignoreTenant(); TenantContextHolder.ignoreTenant();
initResources(); initResources();
List<Tenant> tenants = tenantService.list(); List<Tenant> tenants = tenantService.list();
sysConfigService.initSysConfig(); sysConfigService.initSysConfig();
for (Tenant tenant : tenants) { for (Tenant tenant : tenants) {
taskService.initDefaultFlinkSQLEnv(tenant.getId()); taskService.initDefaultFlinkSQLEnv(tenant.getId());
} }
......
...@@ -21,8 +21,8 @@ package org.dinky.service.resource.impl; ...@@ -21,8 +21,8 @@ package org.dinky.service.resource.impl;
import org.dinky.data.exception.BusException; import org.dinky.data.exception.BusException;
import org.dinky.data.exception.DinkyException; import org.dinky.data.exception.DinkyException;
import org.dinky.oss.OssTemplate;
import org.dinky.service.resource.BaseResourceManager; import org.dinky.service.resource.BaseResourceManager;
import org.dinky.utils.OssTemplate;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
......
...@@ -40,10 +40,6 @@ ...@@ -40,10 +40,6 @@
<artifactId>dinky-app-base</artifactId> <artifactId>dinky-app-base</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-client-1.14</artifactId> <artifactId>dinky-client-1.14</artifactId>
...@@ -53,14 +49,6 @@ ...@@ -53,14 +49,6 @@
<artifactId>dinky-flink-1.14</artifactId> <artifactId>dinky-flink-1.14</artifactId>
<scope>${scope.runtime}</scope> <scope>${scope.runtime}</scope>
</dependency> </dependency>
<dependency>
<groupId>org.dinky</groupId>
<artifactId>dinky-client-base</artifactId>
</dependency>
<dependency>
<groupId>org.dinky</groupId>
<artifactId>dinky-executor</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -22,7 +22,6 @@ package org.dinky.app; ...@@ -22,7 +22,6 @@ package org.dinky.app;
import org.dinky.app.constant.AppParamConstant; import org.dinky.app.constant.AppParamConstant;
import org.dinky.app.db.DBUtil; import org.dinky.app.db.DBUtil;
import org.dinky.app.flinksql.Submitter; import org.dinky.app.flinksql.Submitter;
import org.dinky.app.util.FlinkAppUtil;
import org.dinky.data.app.AppParamConfig; import org.dinky.data.app.AppParamConfig;
import org.dinky.utils.JsonUtils; import org.dinky.utils.JsonUtils;
...@@ -56,9 +55,6 @@ public class MainApp { ...@@ -56,9 +55,6 @@ public class MainApp {
} catch (Exception e) { } catch (Exception e) {
log.error("exectue app failed with config: {}", appConfig); log.error("exectue app failed with config: {}", appConfig);
throw e; throw e;
} finally {
log.info("Start Monitor Job");
FlinkAppUtil.monitorFlinkTask(appConfig.getTaskId());
} }
} }
} }
...@@ -39,10 +39,6 @@ ...@@ -39,10 +39,6 @@
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-app-base</artifactId> <artifactId>dinky-app-base</artifactId>
</dependency> </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-client-1.15</artifactId> <artifactId>dinky-client-1.15</artifactId>
...@@ -52,14 +48,6 @@ ...@@ -52,14 +48,6 @@
<artifactId>dinky-flink-1.15</artifactId> <artifactId>dinky-flink-1.15</artifactId>
<scope>${scope.runtime}</scope> <scope>${scope.runtime}</scope>
</dependency> </dependency>
<dependency>
<groupId>org.dinky</groupId>
<artifactId>dinky-client-base</artifactId>
</dependency>
<dependency>
<groupId>org.dinky</groupId>
<artifactId>dinky-executor</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -22,7 +22,6 @@ package org.dinky.app; ...@@ -22,7 +22,6 @@ package org.dinky.app;
import org.dinky.app.constant.AppParamConstant; import org.dinky.app.constant.AppParamConstant;
import org.dinky.app.db.DBUtil; import org.dinky.app.db.DBUtil;
import org.dinky.app.flinksql.Submitter; import org.dinky.app.flinksql.Submitter;
import org.dinky.app.util.FlinkAppUtil;
import org.dinky.data.app.AppParamConfig; import org.dinky.data.app.AppParamConfig;
import org.dinky.utils.JsonUtils; import org.dinky.utils.JsonUtils;
...@@ -56,9 +55,6 @@ public class MainApp { ...@@ -56,9 +55,6 @@ public class MainApp {
} catch (Exception e) { } catch (Exception e) {
log.error("exectue app failed with config: {}", appConfig); log.error("exectue app failed with config: {}", appConfig);
throw e; throw e;
} finally {
log.info("Start Monitor Job");
FlinkAppUtil.monitorFlinkTask(appConfig.getTaskId());
} }
} }
} }
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-client-${dinky.flink.version}</artifactId> <artifactId>dinky-client-1.16</artifactId>
<scope>${scope.runtime}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-flink-${dinky.flink.version}</artifactId> <artifactId>dinky-flink-1.16</artifactId>
<scope>${scope.runtime}</scope> <scope>${scope.runtime}</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -22,7 +22,6 @@ package org.dinky.app; ...@@ -22,7 +22,6 @@ package org.dinky.app;
import org.dinky.app.constant.AppParamConstant; import org.dinky.app.constant.AppParamConstant;
import org.dinky.app.db.DBUtil; import org.dinky.app.db.DBUtil;
import org.dinky.app.flinksql.Submitter; import org.dinky.app.flinksql.Submitter;
import org.dinky.app.util.FlinkAppUtil;
import org.dinky.data.app.AppParamConfig; import org.dinky.data.app.AppParamConfig;
import org.dinky.utils.JsonUtils; import org.dinky.utils.JsonUtils;
...@@ -55,9 +54,6 @@ public class MainApp { ...@@ -55,9 +54,6 @@ public class MainApp {
Submitter.submit(appConfig); Submitter.submit(appConfig);
} catch (Exception e) { } catch (Exception e) {
log.error("exectue app failed : ", e); log.error("exectue app failed : ", e);
} finally {
log.info("Start Monitor Job");
FlinkAppUtil.monitorFlinkTask(appConfig.getTaskId());
} }
} }
} }
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-client-${dinky.flink.version}</artifactId> <artifactId>dinky-client-1.17</artifactId>
<scope>${scope.runtime}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-flink-${dinky.flink.version}</artifactId> <artifactId>dinky-flink-1.17</artifactId>
<scope>${scope.runtime}</scope> <scope>${scope.runtime}</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -22,7 +22,6 @@ package org.dinky.app; ...@@ -22,7 +22,6 @@ package org.dinky.app;
import org.dinky.app.constant.AppParamConstant; import org.dinky.app.constant.AppParamConstant;
import org.dinky.app.db.DBUtil; import org.dinky.app.db.DBUtil;
import org.dinky.app.flinksql.Submitter; import org.dinky.app.flinksql.Submitter;
import org.dinky.app.util.FlinkAppUtil;
import org.dinky.data.app.AppParamConfig; import org.dinky.data.app.AppParamConfig;
import org.dinky.utils.JsonUtils; import org.dinky.utils.JsonUtils;
...@@ -56,9 +55,6 @@ public class MainApp { ...@@ -56,9 +55,6 @@ public class MainApp {
} catch (Exception e) { } catch (Exception e) {
log.error("exectue app failed with config: {}", appConfig); log.error("exectue app failed with config: {}", appConfig);
throw e; throw e;
} finally {
log.info("Start Monitor Job");
FlinkAppUtil.monitorFlinkTask(appConfig.getTaskId());
} }
} }
} }
...@@ -25,12 +25,11 @@ ...@@ -25,12 +25,11 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-client-${dinky.flink.version}</artifactId> <artifactId>dinky-client-1.18</artifactId>
<scope>${scope.runtime}</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-flink-${dinky.flink.version}</artifactId> <artifactId>dinky-flink-1.18</artifactId>
<scope>${scope.runtime}</scope> <scope>${scope.runtime}</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -22,7 +22,6 @@ package org.dinky.app; ...@@ -22,7 +22,6 @@ package org.dinky.app;
import org.dinky.app.constant.AppParamConstant; import org.dinky.app.constant.AppParamConstant;
import org.dinky.app.db.DBUtil; import org.dinky.app.db.DBUtil;
import org.dinky.app.flinksql.Submitter; import org.dinky.app.flinksql.Submitter;
import org.dinky.app.util.FlinkAppUtil;
import org.dinky.data.app.AppParamConfig; import org.dinky.data.app.AppParamConfig;
import org.dinky.utils.JsonUtils; import org.dinky.utils.JsonUtils;
...@@ -56,9 +55,6 @@ public class MainApp { ...@@ -56,9 +55,6 @@ public class MainApp {
} catch (Exception e) { } catch (Exception e) {
log.error("exectue app failed with config: {}", appConfig); log.error("exectue app failed with config: {}", appConfig);
throw e; throw e;
} finally {
log.info("Start Monitor Job");
FlinkAppUtil.monitorFlinkTask(appConfig.getTaskId());
} }
} }
} }
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
<name>Dinky : App : Base</name> <name>Dinky : App : Base</name>
<dependencies> <dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
...@@ -38,6 +44,44 @@ ...@@ -38,6 +44,44 @@
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-executor</artifactId> <artifactId>dinky-executor</artifactId>
<exclusions>
<exclusion>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java-transport-httpclient5</artifactId>
</exclusion>
<exclusion>
<groupId>org.jeasy</groupId>
<artifactId>easy-rules-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.jeasy</groupId>
<artifactId>easy-rules-spel</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.archive</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.jsch</artifactId>
</exclusion>
<exclusion>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.dinky</groupId>
<artifactId>dinky-gateway</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
package org.dinky.app.db; package org.dinky.app.db;
import org.dinky.app.model.SysConfig;
import org.dinky.data.app.AppDatabase; import org.dinky.data.app.AppDatabase;
import org.dinky.data.app.AppParamConfig; import org.dinky.data.app.AppParamConfig;
import org.dinky.data.app.AppTask; import org.dinky.data.app.AppTask;
...@@ -68,14 +69,8 @@ public class DBUtil { ...@@ -68,14 +69,8 @@ public class DBUtil {
return sb.toString(); return sb.toString();
} }
public static String getSysConfig(String key) throws SQLException { public static List<SysConfig> getSysConfigList() throws SQLException {
Entity option = Entity.create("dinky_sys_config").set("name", key); Entity option = Entity.create("dinky_sys_config");
List<Entity> entities = db.find(option); return db.find(option, SysConfig.class);
if (entities.size() <= 0) {
throw new IllegalArgumentException(
StrFormatter.format("The system conifg is not found: {}, please check! ", key));
} else {
return entities.get(0).getStr("value");
}
} }
} }
...@@ -19,19 +19,33 @@ ...@@ -19,19 +19,33 @@
package org.dinky.app.flinksql; package org.dinky.app.flinksql;
import static org.apache.hadoop.fs.FileSystem.getDefaultUri;
import org.dinky.app.db.DBUtil; import org.dinky.app.db.DBUtil;
import org.dinky.app.model.StatementParam; import org.dinky.app.model.StatementParam;
import org.dinky.app.model.SysConfig;
import org.dinky.app.resource.impl.HdfsResourceManager;
import org.dinky.app.resource.impl.OssResourceManager;
import org.dinky.app.url.RsURLStreamHandlerFactory;
import org.dinky.app.util.FlinkAppUtil;
import org.dinky.assertion.Asserts; import org.dinky.assertion.Asserts;
import org.dinky.config.Dialect;
import org.dinky.constant.FlinkSQLConstant; import org.dinky.constant.FlinkSQLConstant;
import org.dinky.data.app.AppParamConfig; import org.dinky.data.app.AppParamConfig;
import org.dinky.data.app.AppTask; import org.dinky.data.app.AppTask;
import org.dinky.data.enums.Status; import org.dinky.data.exception.DinkyException;
import org.dinky.data.model.SystemConfiguration;
import org.dinky.data.properties.OssProperties;
import org.dinky.executor.Executor; import org.dinky.executor.Executor;
import org.dinky.executor.ExecutorConfig; import org.dinky.executor.ExecutorConfig;
import org.dinky.executor.ExecutorFactory; import org.dinky.executor.ExecutorFactory;
import org.dinky.interceptor.FlinkInterceptor; import org.dinky.interceptor.FlinkInterceptor;
import org.dinky.oss.OssTemplate;
import org.dinky.parser.SqlType; import org.dinky.parser.SqlType;
import org.dinky.trans.Operations; import org.dinky.trans.Operations;
import org.dinky.trans.dml.ExecuteJarOperation;
import org.dinky.trans.parse.AddJarSqlParseStrategy;
import org.dinky.trans.parse.ExecuteJarParseStrategy;
import org.dinky.utils.SqlUtil; import org.dinky.utils.SqlUtil;
import org.dinky.utils.ZipUtils; import org.dinky.utils.ZipUtils;
...@@ -39,6 +53,8 @@ import org.apache.commons.io.FileUtils; ...@@ -39,6 +53,8 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.flink.configuration.PipelineOptions; import org.apache.flink.configuration.PipelineOptions;
import org.apache.flink.python.PythonOptions; import org.apache.flink.python.PythonOptions;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
...@@ -53,15 +69,20 @@ import java.sql.SQLException; ...@@ -53,15 +69,20 @@ import java.sql.SQLException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Singleton;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.URLUtil; import cn.hutool.core.util.URLUtil;
import lombok.SneakyThrows;
/** /**
* FlinkSQLFactory * FlinkSQLFactory
...@@ -71,7 +92,52 @@ import cn.hutool.core.util.URLUtil; ...@@ -71,7 +92,52 @@ import cn.hutool.core.util.URLUtil;
public class Submitter { public class Submitter {
private static final Logger log = LoggerFactory.getLogger(Submitter.class); private static final Logger log = LoggerFactory.getLogger(Submitter.class);
private static void initSystemConfiguration() throws SQLException {
SystemConfiguration systemConfiguration = SystemConfiguration.getInstances();
List<SysConfig> sysConfigList = DBUtil.getSysConfigList();
Map<String, String> configMap =
CollUtil.toMap(sysConfigList, new HashMap<>(), SysConfig::getName, SysConfig::getValue);
systemConfiguration.initSetConfiguration(configMap);
}
private static void initResource() throws SQLException {
SystemConfiguration systemConfiguration = SystemConfiguration.getInstances();
switch (systemConfiguration.getResourcesModel().getValue()) {
case OSS:
OssProperties ossProperties = new OssProperties();
ossProperties.setAccessKey(
systemConfiguration.getResourcesOssAccessKey().getValue());
ossProperties.setSecretKey(
systemConfiguration.getResourcesOssSecretKey().getValue());
ossProperties.setEndpoint(
systemConfiguration.getResourcesOssEndpoint().getValue());
ossProperties.setBucketName(
systemConfiguration.getResourcesOssBucketName().getValue());
ossProperties.setRegion(
systemConfiguration.getResourcesOssRegion().getValue());
Singleton.get(OssResourceManager.class).setOssTemplate(new OssTemplate(ossProperties));
break;
case HDFS:
final Configuration configuration = new Configuration();
configuration.set(
"fs.defaultFS",
systemConfiguration.getResourcesHdfsDefaultFS().getValue());
try {
FileSystem fileSystem = FileSystem.get(
getDefaultUri(configuration),
configuration,
systemConfiguration.getResourcesHdfsUser().getValue());
Singleton.get(HdfsResourceManager.class).setHdfs(fileSystem);
} catch (Exception e) {
throw new DinkyException(e);
}
}
}
public static void submit(AppParamConfig config) throws SQLException { public static void submit(AppParamConfig config) throws SQLException {
initSystemConfiguration();
initResource();
URL.setURLStreamHandlerFactory(new RsURLStreamHandlerFactory());
log.info("{} Start Submit Job:{}", LocalDateTime.now(), config.getTaskId()); log.info("{} Start Submit Job:{}", LocalDateTime.now(), config.getTaskId());
AppTask appTask = DBUtil.getTask(config.getTaskId()); AppTask appTask = DBUtil.getTask(config.getTaskId());
...@@ -89,15 +155,23 @@ public class Submitter { ...@@ -89,15 +155,23 @@ public class Submitter {
// .config(JsonUtils.toMap(appTask.getConfigJson())) // .config(JsonUtils.toMap(appTask.getConfigJson()))
.build(); .build();
Executor executor = ExecutorFactory.buildAppStreamExecutor(executorConfig);
log.info("Start Monitor Job");
FlinkAppUtil.monitorFlinkTask(config.getTaskId());
// 加载第三方jar //TODO 这里有问题,需要修一修 // 加载第三方jar //TODO 这里有问题,需要修一修
// loadDep(appTask.getType(), // loadDep(appTask.getType(),
// config.getTaskId(),DBUtil.getSysConfig(Status.SYS_ENV_SETTINGS_DINKYADDR.getKey()), executorConfig); // config.getTaskId(),DBUtil.getSysConfig(Status.SYS_ENV_SETTINGS_DINKYADDR.getKey()), executorConfig);
log.info("The job configuration is as follows: {}", executorConfig); log.info("The job configuration is as follows: {}", executorConfig);
String[] statements = String[] statements =
SqlUtil.getStatements(sql, DBUtil.getSysConfig(Status.SYS_FLINK_SETTINGS_SQLSEPARATOR.getKey())); SqlUtil.getStatements(sql, SystemConfiguration.getInstances().getSqlSeparator());
excuteJob(executorConfig, statements); if (Dialect.FLINK_JAR == appTask.getDialect()) {
executeJarJob(appTask.getType(), executor, statements);
} else {
executeJob(executor, statements);
}
} }
public static String buildSql(AppTask appTask) throws SQLException { public static String buildSql(AppTask appTask) throws SQLException {
...@@ -209,9 +283,24 @@ public class Submitter { ...@@ -209,9 +283,24 @@ public class Submitter {
} }
} }
public static void excuteJob(ExecutorConfig executorConfig, String[] statements) { @SneakyThrows
public static void executeJarJob(String type, Executor executor, String[] statements) {
for (int i = 0; i < statements.length; i++) {
String sqlStatement = executor.pretreatStatement(statements[i]);
if (ExecuteJarParseStrategy.INSTANCE.match(sqlStatement)) {
ExecuteJarOperation executeJarOperation = new ExecuteJarOperation(sqlStatement);
executeJarOperation.execute(executor.getCustomTableEnvironment());
break;
} else if (Operations.getOperationType(sqlStatement) == SqlType.ADD
&& "kubernetes-application".equals(type)) {
executor.addJar(AddJarSqlParseStrategy.getInfo(sqlStatement));
}
}
}
public static void executeJob(Executor executor, String[] statements) {
Executor executor = ExecutorFactory.buildAppStreamExecutor(executorConfig); ExecutorConfig executorConfig = executor.getExecutorConfig();
List<StatementParam> ddl = new ArrayList<>(); List<StatementParam> ddl = new ArrayList<>();
List<StatementParam> trans = new ArrayList<>(); List<StatementParam> trans = new ArrayList<>();
List<StatementParam> execute = new ArrayList<>(); List<StatementParam> execute = new ArrayList<>();
...@@ -228,11 +317,6 @@ public class Submitter { ...@@ -228,11 +317,6 @@ public class Submitter {
if (!executorConfig.isUseStatementSet()) { if (!executorConfig.isUseStatementSet()) {
break; break;
} }
} else if (operationType.equals(SqlType.EXECUTE)) {
execute.add(new StatementParam(statement, operationType));
if (!executorConfig.isUseStatementSet()) {
break;
}
} else { } else {
ddl.add(new StatementParam(statement, operationType)); ddl.add(new StatementParam(statement, operationType));
} }
......
/*
*
* 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.dinky.app.model;
import java.io.Serializable;
import lombok.Data;
@Data
public class SysConfig implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String name;
private String value;
}
/*
*
* 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.dinky.app.resource;
import org.dinky.app.resource.impl.HdfsResourceManager;
import org.dinky.app.resource.impl.OssResourceManager;
import org.dinky.data.model.SystemConfiguration;
import java.io.InputStream;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Singleton;
public interface BaseResourceManager {
SystemConfiguration instances = SystemConfiguration.getInstances();
InputStream readFile(String path);
static BaseResourceManager getInstance() {
switch (SystemConfiguration.getInstances().getResourcesModel().getValue()) {
case HDFS:
return Singleton.get(HdfsResourceManager.class);
case OSS:
return Singleton.get(OssResourceManager.class);
default:
return null;
}
}
default String getFilePath(String path) {
return FileUtil.normalize(
FileUtil.file(instances.getResourcesUploadBasePath().getValue(), path)
.toString());
}
}
/*
*
* 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.dinky.app.resource.impl;
import org.dinky.app.resource.BaseResourceManager;
import org.dinky.data.exception.BusException;
import org.dinky.data.model.SystemConfiguration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import cn.hutool.core.util.URLUtil;
public class HdfsResourceManager implements BaseResourceManager {
FileSystem hdfs;
SystemConfiguration systemConfiguration = SystemConfiguration.getInstances();
@Override
public InputStream readFile(String path) {
try {
if (systemConfiguration.getResourcesHdfsDefaultFS().getValue().contains("file:/")) {
return new URL("http://" + systemConfiguration.getDinkyAddr().getValue()
+ "/download/downloadFromRs?path=" + URLUtil.encode(path))
.openStream();
}
return getHdfs().open(new Path(getFilePath(path)));
} catch (IOException e) {
throw BusException.valueOf("file.read.failed", e);
}
}
public FileSystem getHdfs() {
if (hdfs == null && instances.getResourcesEnable().getValue()) {
throw BusException.valueOf("Resource configuration error, HDFS is not enabled");
}
return hdfs;
}
public synchronized void setHdfs(FileSystem hdfs) {
this.hdfs = hdfs;
}
}
/*
*
* 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.dinky.app.resource.impl;
import org.dinky.app.resource.BaseResourceManager;
import org.dinky.data.exception.BusException;
import org.dinky.oss.OssTemplate;
import java.io.InputStream;
public class OssResourceManager implements BaseResourceManager {
OssTemplate ossTemplate;
@Override
public InputStream readFile(String path) {
return getOssTemplate()
.getObject(getOssTemplate().getBucketName(), getFilePath(path))
.getObjectContent();
}
public OssTemplate getOssTemplate() {
if (ossTemplate == null && instances.getResourcesEnable().getValue()) {
throw BusException.valueOf("Resource configuration error, OSS is not enabled");
}
return ossTemplate;
}
public void setOssTemplate(OssTemplate ossTemplate) {
this.ossTemplate = ossTemplate;
}
}
/*
*
* 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.dinky.app.url;
import org.dinky.app.resource.BaseResourceManager;
import org.dinky.data.exception.BusException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
public class RsURLConnection extends URLConnection {
private InputStream inputStream;
@Override
public void connect() {
BaseResourceManager instance = BaseResourceManager.getInstance();
if (instance == null) {
throw BusException.valueOf("ResourceManager is disabled");
}
inputStream = instance.readFile(getURL().getPath());
}
@Override
public InputStream getInputStream() {
connect();
return inputStream;
}
public RsURLConnection(URL url) {
super(url);
}
}
/*
*
* 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.dinky.app.url;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
public class RsURLStreamHandler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL u) {
return new RsURLConnection(u);
}
}
/*
*
* 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.dinky.app.url;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
public class RsURLStreamHandlerFactory implements URLStreamHandlerFactory {
private static final String PREFIX = "sun.net.www.protocol";
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
if ("rs".equals(protocol)) {
return new RsURLStreamHandler();
}
try {
Class.forName("org.apache.hadoop.fs.FsUrlStreamHandlerFactory");
} catch (Exception e) {
return null;
}
String name = PREFIX + "." + protocol + ".Handler";
try {
@SuppressWarnings("deprecation")
Object o = Class.forName(name).newInstance();
return (URLStreamHandler) o;
} catch (ClassNotFoundException x) {
// ignore
} catch (Exception e) {
// For compatibility, all Exceptions are ignored.
// any number of exceptions can get thrown here
}
return null;
}
}
...@@ -19,19 +19,20 @@ ...@@ -19,19 +19,20 @@
package org.dinky.app.util; package org.dinky.app.util;
import org.dinky.app.db.DBUtil; import org.dinky.context.CustomTableEnvironmentContext;
import org.dinky.constant.FlinkConstant; import org.dinky.data.model.SystemConfiguration;
import org.dinky.data.enums.JobStatus;
import org.dinky.data.enums.Status;
import org.dinky.utils.JsonUtils; import org.dinky.utils.JsonUtils;
import org.apache.flink.api.common.JobExecutionResult;
import org.apache.flink.api.common.JobStatus;
import org.apache.flink.client.deployment.StandaloneClusterId; import org.apache.flink.client.deployment.StandaloneClusterId;
import org.apache.flink.client.program.rest.RestClusterClient; import org.apache.flink.client.program.rest.RestClusterClient;
import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.GlobalConfiguration; import org.apache.flink.configuration.ReadableConfig;
import org.apache.flink.runtime.client.JobStatusMessage; import org.apache.flink.core.execution.JobClient;
import org.apache.flink.core.execution.JobListener;
import java.util.Collection; import org.apache.flink.runtime.client.JobCancellationException;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import cn.hutool.core.text.StrFormatter; import cn.hutool.core.text.StrFormatter;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
...@@ -46,27 +47,36 @@ public class FlinkAppUtil { ...@@ -46,27 +47,36 @@ public class FlinkAppUtil {
* If the task is completed, it sends a hook notification and stops monitoring. * If the task is completed, it sends a hook notification and stops monitoring.
*/ */
public static void monitorFlinkTask(int taskId) { public static void monitorFlinkTask(int taskId) {
boolean isRun = true; StreamExecutionEnvironment streamExecutionEnvironment =
try (RestClusterClient<StandaloneClusterId> client = createClient()) { CustomTableEnvironmentContext.get().getStreamExecutionEnvironment();
while (isRun) { streamExecutionEnvironment.registerJobListener(new JobListener() {
Collection<JobStatusMessage> jobs = client.listJobs().get(); @Override
if (jobs.isEmpty()) { public void onJobSubmitted(JobClient jobClient, Throwable throwable) {
log.error("No Flink task found, try again in 2 seconds....."); jobClient.getJobExecutionResult().thenAccept(jobExecutionResult -> finshedHook(jobClient, taskId));
} jobClient.getJobStatus().thenAccept(job -> {
for (JobStatusMessage job : jobs) { if (job == JobStatus.FINISHED) {
if (JobStatus.isDone(job.getJobState().toString())) { finshedHook(jobClient, taskId);
sendHook(taskId, job.getJobId().toHexString(), 0);
log.info("hook {} finished.", job.getJobName());
// There should be only one in application mode, so stop monitoring here
isRun = false;
} }
});
}
@Override
public void onJobExecuted(JobExecutionResult jobExecutionResult, Throwable throwable) {
if (throwable instanceof JobCancellationException) {
// todo cancel task
} else {
// other exception
} }
Thread.sleep(5000);
} }
} catch (Exception e) { });
// If an exception is thrown, it will cause the k8s pod to trigger a restart, }
// resulting in an inability to exit normally
log.error("hook failed:", e); private static void finshedHook(JobClient jobClient, int taskId) {
try {
sendHook(taskId, jobClient.getJobID().toHexString(), 0);
log.info("hook finished.");
} catch (InterruptedException e) {
throw new RuntimeException(e);
} }
} }
...@@ -79,9 +89,9 @@ public class FlinkAppUtil { ...@@ -79,9 +89,9 @@ public class FlinkAppUtil {
*/ */
private static void sendHook(int taskId, String jobId, int reTryCount) throws InterruptedException { private static void sendHook(int taskId, String jobId, int reTryCount) throws InterruptedException {
try { try {
String dinkyAddr = DBUtil.getSysConfig(Status.SYS_ENV_SETTINGS_DINKYADDR.getKey()); String dinkyAddr = SystemConfiguration.getInstances().getDinkyAddr().getValue();
String url = StrFormatter.format( String url =
"http://{}/api/jobInstance/hookJobDone?taskId={}&jobId={}", dinkyAddr, taskId, jobId); StrFormatter.format("{}/api/jobInstance/hookJobDone?taskId={}&jobId={}", dinkyAddr, taskId, jobId);
String resultStr = HttpUtil.get(url); String resultStr = HttpUtil.get(url);
// TODO 这里应该使用Result实体类,但是Result.class不在comm里,迁移改动太大,暂时不搞 // TODO 这里应该使用Result实体类,但是Result.class不在comm里,迁移改动太大,暂时不搞
String code = JsonUtils.parseObject(resultStr).get("code").toString(); String code = JsonUtils.parseObject(resultStr).get("code").toString();
...@@ -101,17 +111,16 @@ public class FlinkAppUtil { ...@@ -101,17 +111,16 @@ public class FlinkAppUtil {
/** /**
* Create a REST cluster client for Flink. * Create a REST cluster client for Flink.
*
* @return * @return
* @throws Exception * @throws Exception
*/ */
private static RestClusterClient<StandaloneClusterId> createClient() throws Exception { private static RestClusterClient<StandaloneClusterId> createClient() throws Exception {
Configuration config; ReadableConfig config = CustomTableEnvironmentContext.get()
Configuration fromEnvConfig = GlobalConfiguration.loadConfiguration(); .getStreamExecutionEnvironment()
if (!fromEnvConfig.keySet().isEmpty()) { .getConfiguration();
config = fromEnvConfig; Configuration configuration = new Configuration((Configuration) config);
} else {
config = GlobalConfiguration.loadConfiguration(FlinkConstant.DEFAULT_FLINK_HOME); return new RestClusterClient<>(configuration, StandaloneClusterId.getInstance());
}
return new RestClusterClient<>(config, StandaloneClusterId.getInstance());
} }
} }
...@@ -35,10 +35,6 @@ ...@@ -35,10 +35,6 @@
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-client-base</artifactId> <artifactId>dinky-client-base</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.dinky</groupId>
<artifactId>dinky-common</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-flink-1.14</artifactId> <artifactId>dinky-flink-1.14</artifactId>
......
...@@ -22,6 +22,7 @@ package org.dinky.executor; ...@@ -22,6 +22,7 @@ package org.dinky.executor;
import org.dinky.assertion.Asserts; import org.dinky.assertion.Asserts;
import org.dinky.data.model.LineageRel; import org.dinky.data.model.LineageRel;
import org.dinky.data.result.SqlExplainResult; import org.dinky.data.result.SqlExplainResult;
import org.dinky.utils.JsonUtils;
import org.dinky.utils.LineageContext; import org.dinky.utils.LineageContext;
import org.apache.flink.api.common.RuntimeExecutionMode; import org.apache.flink.api.common.RuntimeExecutionMode;
...@@ -73,6 +74,7 @@ import org.apache.flink.types.Row; ...@@ -73,6 +74,7 @@ import org.apache.flink.types.Row;
import java.io.File; import java.io.File;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
...@@ -81,18 +83,19 @@ import java.util.Map; ...@@ -81,18 +83,19 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.URLUtil;
import lombok.extern.slf4j.Slf4j;
/** /**
* 定制TableEnvironmentImpl * 定制TableEnvironmentImpl
* *
* @since 2021/10/22 10:02 * @since 2021/10/22 10:02
*/ */
@Slf4j
public class CustomTableEnvironmentImpl extends AbstractCustomTableEnvironment { public class CustomTableEnvironmentImpl extends AbstractCustomTableEnvironment {
public CustomTableEnvironmentImpl( public CustomTableEnvironmentImpl(
...@@ -212,21 +215,26 @@ public class CustomTableEnvironmentImpl extends AbstractCustomTableEnvironment { ...@@ -212,21 +215,26 @@ public class CustomTableEnvironmentImpl extends AbstractCustomTableEnvironment {
((DefaultExecutor) executor).getExecutionEnvironment().generateStreamGraph(trans); ((DefaultExecutor) executor).getExecutionEnvironment().generateStreamGraph(trans);
JSONGenerator jsonGenerator = new JSONGenerator(streamGraph); JSONGenerator jsonGenerator = new JSONGenerator(streamGraph);
String json = jsonGenerator.getJSON(); String json = jsonGenerator.getJSON();
ObjectMapper mapper = new ObjectMapper(); return JsonUtils.parseObject(json);
ObjectNode objectNode = mapper.createObjectNode();
try {
objectNode = (ObjectNode) mapper.readTree(json);
} catch (JsonProcessingException e) {
e.printStackTrace();
} finally {
return objectNode;
}
} else { } else {
throw new TableException("Unsupported SQL query! explainSql() need a single SQL to query."); throw new TableException("Unsupported SQL query! explainSql() need a single SQL to query.");
} }
} }
} }
@Override
public void addJar(File... jarPath) {
Configuration configuration = new Configuration(this.getRootConfiguration());
List<String> pathList =
Arrays.stream(URLUtil.getURLs(jarPath)).map(URL::toString).collect(Collectors.toList());
List<String> jars = configuration.get(PipelineOptions.JARS);
if (jars == null) {
configuration.set(PipelineOptions.JARS, pathList);
} else {
CollUtil.addAll(jars, pathList);
}
}
@Override @Override
public JobPlanInfo getJobPlanInfo(List<String> statements) { public JobPlanInfo getJobPlanInfo(List<String> statements) {
return new JobPlanInfo(JsonPlanGenerator.generatePlan(getJobGraphFromInserts(statements))); return new JobPlanInfo(JsonPlanGenerator.generatePlan(getJobGraphFromInserts(statements)));
...@@ -374,19 +382,6 @@ public class CustomTableEnvironmentImpl extends AbstractCustomTableEnvironment { ...@@ -374,19 +382,6 @@ public class CustomTableEnvironmentImpl extends AbstractCustomTableEnvironment {
} }
} }
@Override
public void addJar(File... jarPath) {
Configuration configuration = this.getRootConfiguration();
List<String> jars = configuration.get(PipelineOptions.JARS);
if (jars == null) {
configuration.set(
PipelineOptions.JARS,
Arrays.stream(jarPath).map(File::getAbsolutePath).collect(Collectors.toList()));
} else {
CollUtil.addAll(jars, jarPath);
}
}
@Override @Override
public <T> void createTemporaryView(String path, DataStream<T> dataStream, Expression... fields) { public <T> void createTemporaryView(String path, DataStream<T> dataStream, Expression... fields) {
createTemporaryView(path, fromDataStream(dataStream, fields)); createTemporaryView(path, fromDataStream(dataStream, fields));
......
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
<artifactId>dinky-client-base</artifactId> <artifactId>dinky-client-base</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.dinky</groupId>
<artifactId>dinky-common</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.dinky</groupId> <groupId>org.dinky</groupId>
<artifactId>dinky-flink-1.15</artifactId> <artifactId>dinky-flink-1.15</artifactId>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment