Unverified Commit 089efcd2 authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Feature][UDF]feature_add_udf_manage (#2476)

* feature_add_udf_manage * feature_add_udf_manage * support udf register manage web * feature_add_udf_manage * feature_add_udf_manage * feature_add_udf_manage * feature_add_udf_manage * feature_add_udf_manage --------- Co-authored-by: 's avatarzhu-mingye <934230207@qq.com>
parent 1cdfd5f9
/*
*
* 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.controller;
import org.dinky.data.dto.CommonDTO;
import org.dinky.data.model.Resources;
import org.dinky.data.model.UDFManage;
import org.dinky.data.result.Result;
import org.dinky.data.vo.UDFManageVO;
import org.dinky.service.UDFService;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* Flink udf controller
*/
@Slf4j
@Api(tags = "UDF Controller")
@RestController
@RequestMapping("/api/udf")
@RequiredArgsConstructor
public class UDFController {
private final UDFService udfService;
/**
* update udf name by id
*
* @return Result
*/
@GetMapping("/list")
public Result<List<UDFManageVO>> list() {
return Result.succeed(udfService.selectAll());
}
/**
* update udf
*
* @param udfManage udfManage
* @return Result
*/
@PostMapping("/update")
public Result<Void> update(@RequestBody UDFManage udfManage) {
udfService.update(udfManage);
return Result.succeed();
}
/**
* get udf resources list
*
* @return Result
*/
@GetMapping("/udfResourcesList")
public Result<List<Resources>> udfResourcesList() {
return Result.succeed(udfService.udfResourcesList());
}
/**
* add or update by resource id
*
* @param dto dto
* @return Result
*/
@PostMapping("/addOrUpdateByResourceId")
public Result<Void> saveOrUpdate(@RequestBody CommonDTO<List<Integer>> dto) {
udfService.addOrUpdateByResourceId(dto.getData());
return Result.succeed();
}
}
/*
*
* 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.data.dto;
import org.apache.poi.ss.formula.functions.T;
import lombok.Data;
/**
* When using post, the dto passed as a parameter(使用post时,一个参数传递的dto)
* @param <T> params
*/
@Data
public class CommonDTO<T> {
private T data;
}
/*
*
* 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.data.model;
import org.dinky.mybatis.model.SuperEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("dinky_udf_manage")
@ApiModel(value = "UDFTemplate", description = "User-Defined Function Template")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UDFManage extends SuperEntity<UDFManage> {
@ApiModelProperty(value = "Class Name", dataType = "String", notes = "Class Name")
private String className;
@ApiModelProperty(value = "Task Id", dataType = "Integer", notes = "Task Id")
private Integer taskId;
@ApiModelProperty(value = "Resources Id", dataType = "Integer", notes = "Resources Id")
private Integer resourcesId;
}
/*
*
* 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.data.vo;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
@Data
public class UDFManageVO implements Serializable {
private Integer id;
private String name;
private Boolean enabled;
private String className;
private Integer taskId;
private Integer resourcesId;
/**
* develop or resources
*/
private String source;
private String dialect;
private String fileName;
private Date createTime;
private Date updateTime;
}
/*
*
* 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.mapper;
import org.dinky.data.model.UDFManage;
import org.dinky.data.vo.UDFManageVO;
import org.dinky.mybatis.mapper.SuperMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* UDFManageMapper
*/
@Mapper
public interface UDFManageMapper extends SuperMapper<UDFManage> {
List<UDFManageVO> selectAll();
}
......@@ -19,4 +19,40 @@
package org.dinky.service;
public interface UDFService {}
import org.dinky.data.model.Resources;
import org.dinky.data.model.UDFManage;
import org.dinky.data.vo.UDFManageVO;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.service.IService;
public interface UDFService extends IService<UDFManage> {
/**
* update udf name by id
* @param entity udf
* @return boolean
*/
boolean update(UDFManage entity);
/**
* get all udf
* @return List
*/
List<UDFManageVO> selectAll();
/**
* get udf by id
* @return UDFManage
*/
List<Resources> udfResourcesList();
/**
* add or update udf by resourceIds
* @param resourceIds resourceIds
*/
@Transactional(rollbackFor = Exception.class)
void addOrUpdateByResourceId(List<Integer> resourceIds);
}
......@@ -19,10 +19,136 @@
package org.dinky.service.impl;
import org.dinky.config.Dialect;
import org.dinky.data.model.Resources;
import org.dinky.data.model.UDFManage;
import org.dinky.data.vo.UDFManageVO;
import org.dinky.mapper.UDFManageMapper;
import org.dinky.service.UDFService;
import org.dinky.service.resource.ResourcesService;
import org.dinky.utils.UDFUtils;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/** @since 0.6.8 */
/**
* @since 0.6.8
*/
@Service
public class UDFServiceImpl implements UDFService {}
@RequiredArgsConstructor
@Slf4j
public class UDFServiceImpl extends ServiceImpl<UDFManageMapper, UDFManage> implements UDFService {
private final ResourcesService resourcesService;
@Override
public boolean update(UDFManage entity) {
Assert.notNull(entity, "Entity must be not null");
Integer id = entity.getId();
UDFManage byId = getById(id);
Assert.notNull(byId, "UDFManage not found");
byId.setName(entity.getName());
return super.updateById(byId);
}
@Override
public List<UDFManageVO> selectAll() {
List<UDFManageVO> udfManageList = baseMapper.selectAll();
return udfManageList.stream()
.filter(x -> "resources".equals(x.getSource()))
.peek(x -> {
String fileName = x.getFileName();
if ("jar".equals(FileUtil.getSuffix(fileName))) {
x.setDialect(Dialect.JAVA.getValue());
} else {
x.setDialect(Dialect.PYTHON.getValue());
}
})
.collect(Collectors.toList());
}
@Override
public List<Resources> udfResourcesList() {
return resourcesService.getResourcesTreeByFilter(x -> {
String suffix = FileUtil.getSuffix(x.getFileName());
return x.getIsDirectory() || "jar".equals(suffix) || "zip".equals(suffix) || "py".equals(suffix);
});
}
@Transactional(rollbackFor = Exception.class)
@Override
public void addOrUpdateByResourceId(List<Integer> resourceIds) {
LambdaQueryWrapper<UDFManage> queryWrapper =
new LambdaQueryWrapper<UDFManage>().and(x -> x.isNotNull(UDFManage::getResourcesId));
List<UDFManage> udfManageList = baseMapper.selectList(queryWrapper);
List<Integer> udfManageIdList =
udfManageList.stream().map(UDFManage::getResourcesId).distinct().collect(Collectors.toList());
// 1. Delete all UDFs that are not in the resourceIds list.
List<UDFManage> needDeleteList = udfManageList.stream()
.filter(x -> !resourceIds.contains(x.getResourcesId()))
.collect(Collectors.toList());
removeByIds(needDeleteList);
// 2. Add all UDFs that are not in the UDFManage table.
Collection<Integer> needAddList =
resourceIds.stream().filter(x -> !udfManageIdList.contains(x)).collect(Collectors.toList());
if (CollUtil.isNotEmpty(needAddList)) {
List<Resources> resources = resourcesService.listByIds(needAddList);
List<UDFManage> manageList = resources.stream()
.flatMap(x -> {
String suffix = FileUtil.getSuffix(x.getFileName());
if ("jar".equals(suffix)) {
File file = resourcesService.getFile(x.getId());
List<Class<?>> classes = UDFUtils.getUdfClassByJar(file);
return classes.stream().map(clazz -> {
UDFManage udfManage = UDFManage.builder()
.className(clazz.getName())
.resourcesId(x.getId())
.build();
udfManage.setName(StrUtil.toUnderlineCase(getSimpleClassName(clazz.getName())));
return udfManage;
});
} else if ("py".equals(suffix) || "zip".equals(suffix)) {
File file = resourcesService.getFile(x.getId());
List<String> pythonUdfList = UDFUtils.getPythonUdfList(file.getAbsolutePath());
return pythonUdfList.stream().map(className -> {
UDFManage udfManage = UDFManage.builder()
.className(className)
.resourcesId(x.getId())
.build();
udfManage.setName(StrUtil.toUnderlineCase(getSimpleClassName(className)));
return udfManage;
});
} else {
log.error("Unsupported file type: {}", suffix);
}
return Stream.of();
})
.collect(Collectors.toList());
saveBatch(manageList);
}
}
private static String getSimpleClassName(String className) {
final List<String> packages = StrUtil.split(className, CharUtil.DOT);
if (null == packages || packages.size() < 2) {
return className;
}
return CollUtil.getLast(packages);
}
}
......@@ -41,7 +41,7 @@ public interface BaseResourceManager {
String getFileContent(String path);
InputStream getFile(String path);
InputStream readFile(String path);
static BaseResourceManager getInstance() {
switch (SystemConfiguration.getInstances().getResourcesModel().getValue()) {
......
......@@ -23,7 +23,9 @@ import org.dinky.data.dto.TreeNodeDTO;
import org.dinky.data.model.Resources;
import org.dinky.data.result.Result;
import java.io.File;
import java.util.List;
import java.util.function.Function;
import org.springframework.web.multipart.MultipartFile;
......@@ -77,6 +79,13 @@ public interface ResourcesService extends IService<Resources> {
*/
String getContentByResourceId(Integer id);
/**
* Download files from explorer(从资源管理器下载文件)
* @param id resource id
* @return {@link File}
*/
File getFile(Integer id);
/**
* Upload a file to the specified folder.
*
......@@ -113,4 +122,11 @@ public interface ResourcesService extends IService<Resources> {
* @return {@link Result}< {@link List}< {@link Resources}>>}
*/
List<Resources> getResourcesTree();
/**
* query Resources tree data by filter
* @param filterFunction filter function
* @return {@link Result}< {@link List}< {@link Resources}>>}
*/
List<Resources> getResourcesTreeByFilter(Function<Resources, Boolean> filterFunction);
}
......@@ -68,11 +68,11 @@ public class HdfsResourceManager implements BaseResourceManager {
@Override
public String getFileContent(String path) {
return IoUtil.readUtf8(getFile(path));
return IoUtil.readUtf8(readFile(path));
}
@Override
public InputStream getFile(String path) {
public InputStream readFile(String path) {
try {
return getHdfs().open(new Path(getFilePath(path)));
} catch (IOException e) {
......
......@@ -65,11 +65,11 @@ public class OssResourceManager implements BaseResourceManager {
@Override
public String getFileContent(String path) {
return IoUtil.readUtf8(getFile(path));
return IoUtil.readUtf8(readFile(path));
}
@Override
public InputStream getFile(String path) {
public InputStream readFile(String path) {
return getOssTemplate()
.getObject(getOssTemplate().getBucketName(), getFilePath(path))
.getObjectContent();
......
......@@ -27,10 +27,13 @@ import org.dinky.data.result.Result;
import org.dinky.mapper.ResourcesMapper;
import org.dinky.service.resource.BaseResourceManager;
import org.dinky.service.resource.ResourcesService;
import org.dinky.utils.URLUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
......@@ -161,6 +164,14 @@ public class ResourceServiceImpl extends ServiceImpl<ResourcesMapper, Resources>
return getBaseResourceManager().getFileContent(resources.getFullName());
}
@Override
public File getFile(Integer id) {
Resources resources = getById(id);
Assert.notNull(resources, () -> new BusException(Status.RESOURCE_DIR_OR_FILE_NOT_EXIST));
Assert.isFalse(resources.getSize() > ALLOW_MAX_CAT_CONTENT_SIZE, () -> new BusException("file is too large!"));
return URLUtils.toFile("rs:" + resources.getFullName());
}
@Transactional(rollbackFor = Exception.class)
@Override
public void uploadFile(Integer pid, String desc, MultipartFile file) {
......@@ -289,6 +300,20 @@ public class ResourceServiceImpl extends ServiceImpl<ResourcesMapper, Resources>
return buildResourcesTree(this.list());
}
/**
* query Resources tree data by filter
*
* @param filterFunction filter function
* @return {@link Result}< {@link List}< {@link Resources}>>}
*/
public List<Resources> getResourcesTreeByFilter(Function<Resources, Boolean> filterFunction) {
List<Resources> list = this.list();
return buildResourcesTree(
filterFunction == null
? list
: list.stream().filter(filterFunction::apply).collect(Collectors.toList()));
}
/**
* build resources tree
*
......
......@@ -23,10 +23,16 @@ import org.dinky.config.Dialect;
import org.dinky.data.annotation.SupportDialect;
import org.dinky.data.dto.TaskDTO;
import org.dinky.data.model.Task;
import org.dinky.function.FunctionFactory;
import org.dinky.function.data.model.UDF;
import org.dinky.job.Job;
import org.dinky.job.JobResult;
import org.dinky.utils.UDFUtils;
import java.util.Collections;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.exceptions.ExceptionUtil;
@SupportDialect({Dialect.JAVA, Dialect.PYTHON, Dialect.SCALA})
public class UdfTask extends BaseTask {
......@@ -36,12 +42,22 @@ public class UdfTask extends BaseTask {
@Override
public JobResult execute() throws Exception {
UDFUtils.taskToUDF(BeanUtil.toBean(task, Task.class));
return null;
JobResult jobResult = new JobResult();
jobResult.setSuccess(true);
jobResult.setStatus(Job.JobStatus.SUCCESS);
try {
UDF udf = UDFUtils.taskToUDF(BeanUtil.toBean(task, Task.class));
FunctionFactory.initUDF(Collections.singletonList(udf), task.getId());
} catch (Exception e) {
jobResult.setSuccess(false);
jobResult.setError(ExceptionUtil.getRootCauseMessage(e));
jobResult.setStatus(Job.JobStatus.FAILED);
}
return jobResult;
}
@Override
public boolean stop() {
return false;
return true;
}
}
......@@ -20,17 +20,12 @@
package org.dinky.url;
import org.dinky.data.exception.BusException;
import org.dinky.function.constant.PathConstant;
import org.dinky.service.resource.BaseResourceManager;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
public class RsURLConnection extends URLConnection {
private InputStream inputStream;
......@@ -40,6 +35,7 @@ public class RsURLConnection extends URLConnection {
if (instance == null) {
throw BusException.valueOf("ResourceManager is disabled");
}
inputStream = instance.readFile(getURL().getPath());
}
@Override
......@@ -51,10 +47,4 @@ public class RsURLConnection extends URLConnection {
public RsURLConnection(URL url) {
super(url);
}
public File toFile() {
connect();
String path = StrUtil.join(File.separator, PathConstant.TMP_PATH, "rs", getURL().getPath());
return FileUtil.writeFromStream(inputStream, path);
}
}
......@@ -19,7 +19,6 @@
package org.dinky.url;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
......@@ -27,7 +26,7 @@ import java.net.URLStreamHandler;
public class RsURLStreamHandler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL u) throws IOException {
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.utils;
import org.dinky.function.constant.PathConstant;
import java.io.File;
import cn.hutool.core.util.StrUtil;
/**
* Resources Utils
*/
public class RSUtils {
public static String getFilePath(String path) {
return StrUtil.join(File.separator, PathConstant.TMP_PATH, "rs", path);
}
}
......@@ -2895,3 +2895,14 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', '
- **<font color=''red''>${(exceptions.rootException)?substring(0,20)}</font>**
[Go toTask Web](http://${taskUrl})
', 1, null, null);
CREATE TABLE `dinky_udf_manage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL COMMENT 'udf name',
`class_name` varchar(50) DEFAULT NULL COMMENT 'Complete class name',
`task_id` int(11) DEFAULT NULL COMMENT 'task id',
`resources_id` int(11) DEFAULT NULL COMMENT 'resources id',
`enabled` tinyint(1) DEFAULT 1 COMMENT 'is enable',
`create_time` datetime DEFAULT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ 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.
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dinky.mapper.UDFManageMapper">
<select id="selectAll" resultType="org.dinky.data.vo.UDFManageVO">
select u.*,"develop" source,t.dialect,null file_name from
dinky_udf_manage u LEFT JOIN dinky_task t on t.id=u.task_id WHERE resources_id is null
union ALL
select u.*,"resources" source,null dialect,t.full_name from
dinky_udf_manage u LEFT JOIN dinky_resources t on t.id=u.resources_id WHERE u.task_id is null
</select>
</mapper>
......@@ -30,11 +30,15 @@ import java.util.stream.Collectors;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
/** @since 0.7.0 */
/**
* @since 0.7.0
*/
public class URLUtils {
private static final String TMP_PATH = StrUtil.join(File.separator, System.getProperty("user.dir"), "tmp");
/**
* url download file to local
*
* @param urlPath urlPath
* @return file
*/
......@@ -44,9 +48,9 @@ public class URLUtils {
URLConnection urlConnection = url.openConnection();
if ("http".equals(url.getProtocol())
|| "https".equals(url.getProtocol())
|| "hdfs".equals(url.getProtocol())
|| "rs".equals(url.getProtocol())) {
String path = StrUtil.join(File.separator, TMP_PATH, "downloadFile", url.getPath());
|| "hdfs".equals(url.getProtocol())) {
} else if ("rs".equals(url.getProtocol())) {
String path = StrUtil.join(File.separator, TMP_PATH, "rs", url.getPath());
return FileUtil.writeFromStream(urlConnection.getInputStream(), path);
} else if ("file".equals(url.getProtocol())) {
return new File(url.getPath());
......
......@@ -30,9 +30,18 @@ import java.util.List;
/** @since 0.6.8 */
public class FunctionFactory {
/**
* UDF compilation & packaging initialization(udf编译 & 打包 初始化)
* @param udfClassList udf列表
* @param missionId 当前任务id
* @return 打包过后的路径
*/
public static UDFPath initUDF(List<UDF> udfClassList, Integer missionId) {
return initUDF(udfClassList, missionId, new Configuration());
}
/**
* udf编译 & 打包 初始化
* UDF compilation & packaging initialization(udf编译 & 打包 初始化)
*
* @param udfClassList udf列表
* @param missionId 当前任务id
......
......@@ -24,6 +24,7 @@ import org.dinky.config.Dialect;
import org.dinky.context.DinkyClassLoaderContextHolder;
import org.dinky.context.FlinkUdfPathContextHolder;
import org.dinky.data.exception.DinkyException;
import org.dinky.data.model.SystemConfiguration;
import org.dinky.function.FunctionFactory;
import org.dinky.function.compiler.CustomStringJavaCompiler;
import org.dinky.function.compiler.CustomStringScalaCompiler;
......@@ -94,7 +95,9 @@ public class UDFUtil {
public static final String YARN = "YARN";
public static final String APPLICATION = "APPLICATION";
/** 网关类型 map 快速获取 session 与 application 等类型,为了减少判断 */
/**
* 网关类型 map 快速获取 session 与 application 等类型,为了减少判断
*/
public static final Map<String, List<GatewayType>> GATEWAY_TYPE_MAP = MapUtil.builder(
SESSION,
Arrays.asList(GatewayType.YARN_SESSION, GatewayType.KUBERNETES_SESSION, GatewayType.STANDALONE))
......@@ -103,7 +106,9 @@ public class UDFUtil {
.build();
protected static final Logger log = LoggerFactory.getLogger(UDFUtil.class);
/** 存放 udf md5与版本对应的k,v值 */
/**
* 存放 udf md5与版本对应的k,v值
*/
protected static final Map<String, Integer> UDF_MD5_MAP = new HashMap<>();
public static final String PYTHON_UDF_ATTR = "(\\S)\\s+=\\s+ud(?:f|tf|af|taf)";
......@@ -268,7 +273,9 @@ public class UDFUtil {
}
}
/** 扫描udf包文件,写入md5到 UDF_MD5_MAP */
/**
* 扫描udf包文件,写入md5到 UDF_MD5_MAP
*/
@Deprecated
private static void scanUDFMD5() {
List<String> fileList = FileUtil.listFileNames(PathConstant.UDF_PATH);
......@@ -367,6 +374,10 @@ public class UDFUtil {
return classList;
}
public static List<String> getPythonUdfList(String udfFile) {
return getPythonUdfList(SystemConfiguration.getInstances().getPythonHome(), udfFile);
}
public static List<String> getPythonUdfList(String pythonPath, String udfFile) {
File checkFile = new File(PathConstant.TMP_PATH, "getPyFuncList.py");
if (!checkFile.exists()) {
......@@ -386,13 +397,11 @@ public class UDFUtil {
configuration.set(PythonOptions.PYTHON_FILES, udfFile + ".zip");
configuration.set(PythonOptions.PYTHON_CLIENT_EXECUTABLE, pythonPath);
configuration.set(PythonOptions.PYTHON_EXECUTABLE, pythonPath);
System.out.println(udfName);
try {
PythonFunctionFactory.getPythonFunction(udfName, configuration, null);
successUdfList.add(udfName);
} catch (Exception e) {
e.printStackTrace();
log.error("", e);
}
}
return successUdfList;
......
/*
*
* 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.
*
*/
import React, {Key} from 'react';
import {theme, Transfer, Tree} from 'antd';
import type {TransferDirection, TransferItem} from 'antd/es/transfer';
import type {DataNode} from 'antd/es/tree';
interface TreeTransferProps {
dataSource: DataNode[];
targetKeys: Key[];
onChange?: (targetKeys: Key[], direction: TransferDirection, moveKeys: string[]) => void;
height?: number;
}
const isChecked = (selectedKeys: React.Key[], eventKey: React.Key) =>
selectedKeys.includes(eventKey);
const generateTree = (treeNodes: DataNode[] = [], checkedKeys: Key[] = []): DataNode[] =>
treeNodes.map(({children, ...props}) => ({
...props,
disabled: checkedKeys.includes(props.key as string),
children: generateTree(children, checkedKeys),
}));
export const TreeTransfer: React.FC<TreeTransferProps> = ({dataSource, targetKeys,height, ...restProps}) => {
const {token} = theme.useToken();
const transferDataSource: TransferItem[] = [];
function flatten(list: DataNode[] = []) {
list.forEach((item) => {
transferDataSource.push(item as TransferItem);
flatten(item.children);
});
}
flatten(dataSource);
return (
<Transfer
{...restProps}
// @ts-ignore Don't worry about it here
targetKeys={targetKeys}
dataSource={transferDataSource}
className="tree-transfer"
render={(item) => item.path}
showSelectAll={false}
>
{({direction, onItemSelect, selectedKeys}) => {
if (direction === 'left') {
const checkedKeys = [...selectedKeys, ...targetKeys];
return (
<div style={{padding: token.paddingXS}}>
<Tree
height={height}
blockNode
checkable
checkStrictly
defaultExpandAll
checkedKeys={checkedKeys}
treeData={generateTree(dataSource, targetKeys)}
onCheck={(_, {node: {key}}) => {
onItemSelect(key as string, !isChecked(checkedKeys, key));
}}
onSelect={(_, {node: {key}}) => {
onItemSelect(key as string, !isChecked(checkedKeys, key));
}}
/>
</div>
);
}
}}
</Transfer>
);
};
......@@ -206,8 +206,8 @@ ol {
}
.ant-table-wrapper {
overflow-x: auto;
overflow-y: auto;
overflow-x: hidden;
overflow-y: hidden;
overflow-block: auto;
}
......
......@@ -59,7 +59,7 @@ export default {
'menu.registration.document': 'Document',
'menu.registration.fragment': 'Global Variable',
'menu.registration.gitproject': 'Git Project(Beta)',
'menu.registration.udf': 'UDF Template',
'menu.registration.udf': 'UDF',
'menu.registration.resource': 'Resource',
'menu.auth': 'Auth Center',
'menu.auth.user': 'User',
......
......@@ -59,7 +59,7 @@ export default {
'menu.registration.document': '文档',
'menu.registration.fragment': '全局变量',
'menu.registration.gitproject': 'Git 项目(Beta)',
'menu.registration.udf': 'UDF 模板',
'menu.registration.udf': 'UDF',
'menu.registration.resource': '资源',
'menu.auth': '认证中心',
'menu.auth.user': '用户',
......
/*
*
* 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.
*
*/
import {ProColumns} from "@ant-design/pro-components";
import {UDFRegisterInfo, UDFRegisterInfoParent} from "@/types/RegCenter/data";
import {EditBtn} from "@/components/CallBackButton/EditBtn";
import {PopconfirmDeleteBtn} from "@/components/CallBackButton/PopconfirmDeleteBtn";
import {Key, useEffect, useRef, useState} from "react";
import ProTable, {ActionType} from "@ant-design/pro-table";
import {useRequest} from "@@/plugin-request";
import {API_CONSTANTS} from "@/services/endpoints";
import {Button, Modal} from "antd";
import {PlusOutlined} from "@ant-design/icons";
import {TreeTransfer} from "@/components/Transfer/TreeTransfer";
import {buildResourceTreeData} from "@/pages/RegCenter/Resource/components/FileTree/function";
import {add, update} from "./service";
import {l} from "@/utils/intl";
const UDFRegister = () => {
const req = useRequest<{
data: UDFRegisterInfo[]
}>({
url: API_CONSTANTS.UDF_LIST
});
const req_resources = useRequest({
url: API_CONSTANTS.UDF_RESOURCES_LIST
});
const actionRef = useRef<ActionType>();
const [udfRegisterState, setUDFRegisterState] = useState<{
editableKeys: Key[];
isEdit: boolean;
isAdd: boolean;
dataSource: UDFRegisterInfo[];
}>({
editableKeys: [],
dataSource: [],
isEdit: false,
isAdd: false,
});
const [showEdit, setShowEdit] = useState<boolean>(false);
const [targetKeys, setTargetKeys] = useState<Key[]>([]);
useEffect(() => {
setTargetKeys([...new Set(req.data?.map(x => x.resourcesId))])
}, [req.data])
const editableKeysChange = (editableKeys: Key[]) => {
setUDFRegisterState(prevState => ({...prevState, editableKeys}));
}
const groupData: {
[p: string]: UDFRegisterInfo[] | undefined
} = Object.fromEntries(
Array.from(new Set(req.data?.map(({fileName}) => fileName))).map((type) => [
type,
req.data?.filter((item) => item.fileName === type),
]),
)
const parentData: UDFRegisterInfoParent[] = Object.keys(groupData)?.map((key) => {
const d = groupData[key] ?? [];
return {
resourcesId: d[0].resourcesId,
dialect: d[0].dialect,
source: d[0].source,
fileName: key,
num: d.length,
}
})
const columnsParent: ProColumns<UDFRegisterInfoParent>[] = [
{
title: '文件名称',
width: 120,
dataIndex: 'fileName',
}, {
title: 'udf解析数量',
width: 120,
dataIndex: 'num',
}, {
title: '来源',
width: 120,
dataIndex: 'source',
valueEnum: {
resources: {text: "resources"},
develop: {text: 'develop'},
}
}, {
title: '语言',
width: 120,
dataIndex: 'dialect',
valueEnum: {
java: {text: "Java"},
python: {text: 'Python'},
}
}
]
const expandedRowRender = (expandedRow: UDFRegisterInfoParent) => {
const columns: ProColumns<UDFRegisterInfo>[] = [
{
title: '名称',
dataIndex: 'name',
width: '10%',
formItemProps: {
rules: [
{
required: true,
message: '请输入名称',
},
],
},
},
{
title: '类名',
dataIndex: 'className',
readonly: true,
width: '15%',
},
{
title: '更新时间',
dataIndex: 'updateTime',
readonly: true,
valueType: 'dateTime',
width: '15%',
},
{
title: '操作',
valueType: 'option',
width: '10%',
render: (_text, record, _, action) => {
return [
<EditBtn key={`${record.id}_edit`} onClick={() => {
action?.startEditable?.(record.id);
setUDFRegisterState(prevState => ({...prevState, isEdit: true, isAdd: false}));
}}/>
, record.source == "develop" ?
<PopconfirmDeleteBtn key={`${record.id}_delete`} onClick={() => {
}} description={"确定删除吗???"}/>
: <></>
]
},
}
]
return (
<ProTable
rowKey={"id"}
columns={columns}
headerTitle={false}
search={false}
options={false}
dataSource={groupData[expandedRow.fileName]}
pagination={false}
actionRef={actionRef}
editable={{
deleteText: false,
type: 'single',
editableKeys: udfRegisterState.editableKeys,
onChange: editableKeysChange,
onSave: async (_, row) => {
await update(row.id, row.name);
await req.refresh();
actionRef.current?.reload();
},
actionRender: (_, _2, defaultDom) => [
defaultDom.save,
defaultDom.cancel
]
}}
/>
);
};
return (
<>
<ProTable<UDFRegisterInfoParent>
dataSource={parentData}
columns={columnsParent}
rowKey="resourcesId"
pagination={{
showQuickJumper: true,
}}
expandable={{expandedRowRender}}
search={false}
dateFormatter="string"
options={false}
toolBarRender={() => [
<Button
type="primary"
onClick={() => {
setShowEdit(true);
}}
icon={<PlusOutlined/>}
>
{l('button.create')}
</Button>
]}
/>
<Modal width={1500} open={showEdit} destroyOnClose closable onCancel={() => setShowEdit(false)}
onOk={() => {
add(targetKeys).then(() => {
req.refresh().then(() => {
setShowEdit(false)
})
})
}}>
<TreeTransfer dataSource={buildResourceTreeData(req_resources.data ?? [])}
targetKeys={targetKeys} onChange={setTargetKeys} height={500}/>
</Modal>
</>
)
}
export default UDFRegister
/*
*
* 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.
*
*/
import {postAll} from "@/services/api";
import {API_CONSTANTS} from "@/services/endpoints";
import {Key} from "react";
export const add = (ids:Key[]) => {
return postAll(API_CONSTANTS.UDF_ADD,{data:ids});
}
export const update = (id:Key,name:string) => {
return postAll(API_CONSTANTS.UDF_UPDATE,{id,name});
}
\ No newline at end of file
/*
*
* 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.
......@@ -13,6 +14,7 @@
* 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.
*
*/
import CodeEdit from '@/components/CustomEditor/CodeEdit';
......
/*
*
* 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.
......@@ -13,10 +14,11 @@
* 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.
*
*/
import { FormContextValue } from '@/components/Context/FormContext';
import TemplateProFrom from '@/pages/RegCenter/UDF/components/TemplateModal/TemplateProFrom';
import TemplateProFrom from '@/pages/RegCenter/UDF/components/UDFTemplate/TemplateModal/TemplateProFrom';
import { GitProject, UDFTemplate } from '@/types/RegCenter/data';
import { l } from '@/utils/intl';
import { ModalForm } from '@ant-design/pro-components';
......
/*
*
* 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.
......@@ -13,6 +14,7 @@
* 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.
*
*/
import { CreateBtn } from '@/components/CallBackButton/CreateBtn';
......@@ -21,7 +23,6 @@ import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn';
import { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn';
import CodeShow from '@/components/CustomEditor/CodeShow';
import { Authorized, HasAuthority } from '@/hooks/useAccess';
import TemplateModal from '@/pages/RegCenter/UDF/components/TemplateModal';
import {
CODE_TYPE_ENUM,
CODE_TYPE_FILTER,
......@@ -39,6 +40,7 @@ import { l } from '@/utils/intl';
import { ProTable } from '@ant-design/pro-components';
import { ActionType, ProColumns } from '@ant-design/pro-table';
import React, { useRef, useState } from 'react';
import TemplateModal from '../TemplateModal';
import UDFTemplateDrawer from '../UDFTemplateDrawer';
const CodeShowProps: any = {
......
......@@ -20,7 +20,7 @@
import { UDFTemplate } from '@/types/RegCenter/data';
import { Drawer } from 'antd';
import React from 'react';
import UDFTemplateDesc from './UDFTemplateDesc';
import UDFTemplateDesc from "@/pages/RegCenter/UDF/components/UDFTemplate/UDFTemplateDrawer/UDFTemplateDesc";
type UDFTemplateDrawerProps = {
onCancel: (flag?: boolean) => void;
......
/*
*
* 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.
......@@ -13,18 +14,40 @@
* 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.
*
*/
import SlowlyAppear from '@/components/Animation/SlowlyAppear';
import TemplateTable from '@/pages/RegCenter/UDF/components/TemplateTable';
import { PageContainer } from '@ant-design/pro-components';
import TemplateTable from '@/pages/RegCenter/UDF/components/UDFTemplate/TemplateTable';
import {PageContainer} from '@ant-design/pro-components';
import UDFRegister from "@/pages/RegCenter/UDF/components/UDFRegister";
import * as React from "react";
export default () => {
return (
<SlowlyAppear>
<PageContainer title={false}>
<TemplateTable />
</PageContainer>
<PageContainer
tabProps={{
type: 'card',
size: 'small',
animated: true,
tabBarGutter: 10,
centered: true,
}}
tabList={[
{
tab: 'UDF 注册管理',
key: 'udf-register',
children: <UDFRegister />,
},
{
tab: 'UDF 模版',
key: 'udf-template',
children: <TemplateTable />,
},
]}
title={false}
/>
</SlowlyAppear>
);
};
......@@ -17,9 +17,6 @@
*
*/
/**
* the interface api constants
*/
export enum API_CONSTANTS {
// --- user ---
// login path
......@@ -187,6 +184,12 @@ export enum API_CONSTANTS {
// ---- get project build logs by id----
GIT_PROJECT_BUILD_STEP_LOGS = '/api/git/build-step-logs',
//UDF Manage
UDF_LIST = '/api/udf/list',
UDF_RESOURCES_LIST = '/api/udf/udfResourcesList',
UDF_ADD = '/api/udf/addOrUpdateByResourceId',
UDF_UPDATE = '/api/udf/update',
// UDF template
UDF_TEMPLATE = '/api/udf/template/list',
// UDF template add or update
......
/*
*
* 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.
......@@ -13,6 +14,7 @@
* 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.
*
*/
import { BaseBeanColumns } from '@/types/Public/data';
......@@ -221,6 +223,41 @@ export type UDFTemplate = BaseBeanColumns & {
templateCode: string;
};
export interface UDFRegisterInfo {
id: number;
resourcesId: number;
name: string;
className: string;
enable: boolean;
dialect: string;
source: string;
fileName: string;
// tenantId: number;
// createTime: string;
updateTime: Date;
}
export interface UDFRegisterInfoParent {
num: number;
resourcesId: number;
dialect: string;
source: string;
fileName: string;
}
export interface UDFRegisterInfoChild {
id: number;
resourcesId: number;
name: string;
className: string;
enable: boolean;
dialect: string;
source: string;
fileName: string;
// tenantId: number;
// createTime: string;
updateTime: Date;
}
export interface ResourceInfo {
id: number;
fileName: string;
......
......@@ -858,6 +858,7 @@
</scm>
<repositories>
<repository>
<snapshots />
<id>apache-snapshots</id>
<url>https://maven.aliyun.com/repository/apache-snapshots</url>
</repository>
......
......@@ -1921,3 +1921,15 @@ INSERT INTO dinky_alert_template VALUES (1, 'Default', '
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `dinky_udf_manage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL COMMENT 'udf name',
`class_name` varchar(50) DEFAULT NULL COMMENT 'Complete class name',
`task_id` int(11) DEFAULT NULL COMMENT 'task id',
`resources_id` int(11) DEFAULT NULL COMMENT 'resources id',
`enabled` tinyint(1) DEFAULT 1 COMMENT 'is enable',
`create_time` datetime DEFAULT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time',
PRIMARY KEY (`id`) USING BTREE,
KEY `name,resources_id` (`name`,`resources_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='udf';
\ No newline at end of file
......@@ -2739,3 +2739,40 @@ INSERT INTO public.dinky_alert_template VALUES (1, 'Default', '
', 1, null, null);
COMMIT;
CREATE TABLE "public"."dinky_udf_manage" (
"id" int4 NOT NULL,
"name" varchar(50) COLLATE "pg_catalog"."default",
"class_name" varchar(50) COLLATE "pg_catalog"."default",
"task_id" int4,
"resources_id" int4,
"enabled" int2,
"create_time" timestamp(6),
"update_time" timestamp(6),
CONSTRAINT "dinky_udf_manage_pkey" PRIMARY KEY ("id")
)
;
ALTER TABLE "public"."dinky_udf_manage"
OWNER TO "postgres";
CREATE INDEX "name,resources_id" ON "public"."dinky_udf_manage" USING btree (
"name" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"resources_id" "pg_catalog"."int2_ops" ASC NULLS LAST
);
COMMENT ON COLUMN "public"."dinky_udf_manage"."name" IS 'udf name';
COMMENT ON COLUMN "public"."dinky_udf_manage"."class_name" IS 'Complete class name';
COMMENT ON COLUMN "public"."dinky_udf_manage"."task_id" IS 'task id';
COMMENT ON COLUMN "public"."dinky_udf_manage"."resources_id" IS 'resources id';
COMMENT ON COLUMN "public"."dinky_udf_manage"."enabled" IS 'is enable';
COMMENT ON COLUMN "public"."dinky_udf_manage"."create_time" IS 'create time';
COMMENT ON COLUMN "public"."dinky_udf_manage"."update_time" IS 'update time';
COMMENT ON TABLE "public"."dinky_udf_manage" IS 'udf';
\ No newline at end of file
......@@ -290,6 +290,18 @@ CREATE TABLE `dinky_sys_token` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='token management';
CREATE TABLE `dinky_udf_manage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL COMMENT 'udf name',
`class_name` varchar(50) DEFAULT NULL COMMENT 'Complete class name',
`task_id` int(11) DEFAULT NULL COMMENT 'task id',
`resources_id` int(11) DEFAULT NULL COMMENT 'resources id',
`enabled` tinyint(1) DEFAULT 1 COMMENT 'is enable',
`create_time` datetime DEFAULT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time',
PRIMARY KEY (`id`) USING BTREE,
KEY `name,resources_id` (`name`,`resources_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='udf';
drop table if exists dinky_task_statement;
......
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