Skip to content

Commit

Permalink
Remove statements (DataLinkDC#2377)
Browse files Browse the repository at this point in the history
* fix dag npe

* refactor task submit

* merge dev

* merge dev and formate code

* fix some problem

* merge dev

* remove useSession

* formate code

* formate code

* fix task vesion time

* change task version create

* formate code

* remove statement

* refactor ddl, merge statement

* formate code

* optimizeTheCode

* formate code
  • Loading branch information
gaoyan1998 authored Oct 11, 2023
1 parent 0ba9d2c commit 96ce025
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 414 deletions.
7 changes: 0 additions & 7 deletions dinky-admin/src/main/java/org/dinky/assertion/Assert.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.dinky.data.exception.BusException;
import org.dinky.data.model.Cluster;
import org.dinky.data.model.Jar;
import org.dinky.data.model.Statement;
import org.dinky.data.model.Task;

/**
Expand All @@ -44,12 +43,6 @@ static void check(Task task) {
}
}

static void check(Statement statement) {
if (statement == null) {
throw new BusException("FlinkSql语句不存在");
}
}

static void checkHost(String host) {
if (host == null || "".equals(host)) {
throw new BusException("集群地址暂不可用");
Expand Down

This file was deleted.

16 changes: 16 additions & 0 deletions dinky-admin/src/main/java/org/dinky/controller/TaskController.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
import org.dinky.job.JobResult;
import org.dinky.process.exception.ExcuteException;
import org.dinky.service.TaskService;
import org.dinky.utils.JsonUtils;

import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
Expand Down Expand Up @@ -172,6 +174,20 @@ public Result<TaskDTO> getOneById(@RequestParam Integer id) {
return Result.succeed(taskService.getTaskInfoById(id));
}

@PostMapping("/getPrintTables")
@ApiOperation("Get Print Tables")
@SuppressWarnings("unchecked")
@ApiImplicitParam(name = "statement", value = "Statement", dataType = "String", paramType = "body", required = true)
public Result<List<String>> getPrintTables(@RequestBody String statement) {
try {
Map<String, String> data = JsonUtils.toMap(statement);
String ss = data.get("statement");
return Result.succeed(taskService.getPrintTables(ss));
} catch (Exception e) {
return Result.failed(e.getMessage());
}
}

@GetMapping(value = "/listFlinkSQLEnv")
@ApiOperation("Get All FlinkSQLEnv")
public Result<List<Task>> listFlinkSQLEnv() {
Expand Down
56 changes: 0 additions & 56 deletions dinky-admin/src/main/java/org/dinky/data/model/Statement.java

This file was deleted.

33 changes: 0 additions & 33 deletions dinky-admin/src/main/java/org/dinky/mapper/StatementMapper.java

This file was deleted.

37 changes: 0 additions & 37 deletions dinky-admin/src/main/java/org/dinky/service/StatementService.java

This file was deleted.

2 changes: 2 additions & 0 deletions dinky-admin/src/main/java/org/dinky/service/TaskService.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ public interface TaskService extends ISuperService<Task> {
List<JobTypeOverView> getTaskOnlineRate();

JobModelOverview getJobStreamingOrBatchModelOverview();

List<String> getPrintTables(String statement);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.dinky.data.model.History;
import org.dinky.data.model.JobHistory;
import org.dinky.data.model.JobInstance;
import org.dinky.data.model.Statement;
import org.dinky.data.model.Task;
import org.dinky.data.result.Result;
import org.dinky.mapper.CatalogueMapper;
Expand All @@ -38,7 +37,6 @@
import org.dinky.service.HistoryService;
import org.dinky.service.JobHistoryService;
import org.dinky.service.JobInstanceService;
import org.dinky.service.StatementService;
import org.dinky.service.TaskService;

import java.io.BufferedReader;
Expand Down Expand Up @@ -80,8 +78,6 @@ public class CatalogueServiceImpl extends SuperServiceImpl<CatalogueMapper, Cata

private final JobHistoryService jobHistoryService;

private final StatementService statementService;

/**
* @return
*/
Expand Down Expand Up @@ -304,13 +300,6 @@ public boolean copyTask(Catalogue catalogue) {
newTask.setStep(JobLifeCycle.DEVELOP.getValue());
taskService.save(newTask);

Statement statementServiceById = statementService.getById(catalogue.getTaskId());
// 新建作业的sql语句
Statement statement = new Statement();
statement.setStatement(statementServiceById.getStatement());
statement.setId(newTask.getId());
statementService.save(statement);

Catalogue singleCatalogue =
this.getOne(new LambdaQueryWrapper<Catalogue>().eq(Catalogue::getTaskId, catalogue.getTaskId()));

Expand Down Expand Up @@ -420,8 +409,6 @@ public Result<Void> deleteCatalogueById(Integer catalogueId) {
// doing: cascade delete jobInstance && jobHistory && history && statement
// 获取 task 表中的作业
Task task = taskService.getById(catalogue.getTaskId());
// 获取 statement 表中的作业
Statement statement = statementService.getById(catalogue.getTaskId());
// 获取 job instance 表中的作业
List<JobInstance> jobInstanceList = jobInstanceService.list(
new LambdaQueryWrapper<JobInstance>().eq(JobInstance::getTaskId, catalogue.getTaskId()));
Expand All @@ -443,10 +430,6 @@ public Result<Void> deleteCatalogueById(Integer catalogueId) {
if (task != null) {
taskService.removeById(task.getId());
}
// 删除 statement 表中的作业
if (statement != null) {
statementService.removeById(statement.getId());
}
}

// 如果是文件夹 , 且下边没有子文件夹 , 则删除
Expand Down
Loading

0 comments on commit 96ce025

Please sign in to comment.