Unverified Commit 803c8d83 authored by ZackYoung's avatar ZackYoung Committed by GitHub

[fix][udf]修复udf逻辑遗留问题 (#1174)

* 因为之前udf 开发逻辑遗留问题,导致其他任务添加savepoint变null.null

* 因为之前udf 开发逻辑遗留问题,导致其他任务添加savepoint变null.null

* 更新sql模板语句
parent 0459b324
...@@ -377,7 +377,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -377,7 +377,6 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
task.setStatement(code); task.setStatement(code);
} }
} }
}
// to compiler udf // to compiler udf
if (Asserts.isNotNullString(task.getDialect()) && Dialect.JAVA.equalsVal(task.getDialect()) if (Asserts.isNotNullString(task.getDialect()) && Dialect.JAVA.equalsVal(task.getDialect())
&& Asserts.isNotNullString(task.getStatement())) { && Asserts.isNotNullString(task.getStatement())) {
...@@ -385,9 +384,10 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -385,9 +384,10 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
task.setSavePointPath(compiler.getFullClassName()); task.setSavePointPath(compiler.getFullClassName());
} else if (Dialect.PYTHON.equalsVal(task.getDialect())) { } else if (Dialect.PYTHON.equalsVal(task.getDialect())) {
task.setSavePointPath(task.getName() + "." + UDFUtil.getPyUDFAttr(task.getStatement())); task.setSavePointPath(task.getName() + "." + UDFUtil.getPyUDFAttr(task.getStatement()));
} else { } else if (Dialect.SCALA.equalsVal(task.getDialect())) {
task.setSavePointPath(UDFUtil.getScalaFullClassName(task.getStatement())); task.setSavePointPath(UDFUtil.getScalaFullClassName(task.getStatement()));
} }
}
// if modify task else create task // if modify task else create task
if (task.getId() != null) { if (task.getId() != null) {
......
...@@ -64,6 +64,13 @@ public class UDFServiceImpl implements UDFService { ...@@ -64,6 +64,13 @@ public class UDFServiceImpl implements UDFService {
@Resource @Resource
TaskService taskService; TaskService taskService;
/**
* init udf
*
* @param statement sql 语句
* @param gatewayType flink gateway类型
* @return {@link UDFPath}
*/
@Override @Override
public UDFPath initUDF(String statement, GatewayType gatewayType) { public UDFPath initUDF(String statement, GatewayType gatewayType) {
if (gatewayType == GatewayType.KUBERNETES_APPLICATION) { if (gatewayType == GatewayType.KUBERNETES_APPLICATION) {
......
...@@ -71,4 +71,3 @@ VALUES (4, 'python_udf_1', 'Python', 'UDF', 'from pyflink.table import ScalarFun ...@@ -71,4 +71,3 @@ VALUES (4, 'python_udf_1', 'Python', 'UDF', 'from pyflink.table import ScalarFun
INSERT INTO `dlink_udf_template` (`id`, `name`, `code_type`, `function_type`, `template_code`, `enabled`, `create_time`, `update_time`) INSERT INTO `dlink_udf_template` (`id`, `name`, `code_type`, `function_type`, `template_code`, `enabled`, `create_time`, `update_time`)
VALUES (5, 'python_udf_2', 'Python', 'UDF', 'from pyflink.table import DataTypes\nfrom pyflink.table.udf import udf\n\n@udf(result_type=DataTypes.STRING())\ndef ${className}(variable1:string):\n return \'\'', NULL, '2022-10-25 09:25:13', '2022-10-25 09:34:47'); VALUES (5, 'python_udf_2', 'Python', 'UDF', 'from pyflink.table import DataTypes\nfrom pyflink.table.udf import udf\n\n@udf(result_type=DataTypes.STRING())\ndef ${className}(variable1:string):\n return \'\'', NULL, '2022-10-25 09:25:13', '2022-10-25 09:34:47');
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