You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "Wei-Alwayers (via GitHub)" <gi...@apache.org> on 2023/12/15 02:53:33 UTC
[PR] [Feature][datasource-plugin] Add DolphinDB Datasource Plugin [dolphinscheduler]
Wei-Alwayers opened a new pull request, #15324:
URL: https://github.com/apache/dolphinscheduler/pull/15324
<!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
## Purpose of the pull request
Add a new dolphinscheduler-datasource-plugin: DolphinDB
<!--(For example: This pull request adds checkstyle plugin).-->
## Brief change log
1. **Support the datasource of dolphindb. File changes:**
* Add a module names dolphinscheduler-datasource-dolphindb in module dolphinscheduler-datasource-plugin.
* Add DOLPHINDB option in use-datasource.ts,types.ts,use-form.ts .
2. **Add the serializations of dolphindb's data type. File changes:**
* Add serializer folder in dolphinscheduler-common module,add a serialization module for DDB_MOUDLE was added and registered in JSONUtils
3. **Modified some of the source code in sqlTask so that it can run the dolphindb script normally. File changes:**
* Modified the executeUpdate method in sqlTask to run dolphindb's sql scripts.
<!--*(for example:)*
- *Add maven-checkstyle-plugin to root pom.xml*
-->
## Verify this pull request
<!--*(Please pick either of the following options)*-->
This pull request is code cleanup without any test coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][datasource-plugin] Add DolphinDB Datasource Plugin [dolphinscheduler]
Posted by "fuchanghai (via GitHub)" <gi...@apache.org>.
fuchanghai commented on code in PR #15324:
URL: https://github.com/apache/dolphinscheduler/pull/15324#discussion_r1429383402
##########
dolphinscheduler-common/pom.xml:
##########
@@ -51,6 +51,12 @@
<artifactId>httpclient</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.dolphindb</groupId>
+ <artifactId>jdbc</artifactId>
Review Comment:
version should be managed in ``` dolphinscheduler-bom```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][datasource-plugin] Add DolphinDB Datasource Plugin [dolphinscheduler]
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #15324:
URL: https://github.com/apache/dolphinscheduler/pull/15324#discussion_r1429371110
##########
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-dolphindb/src/main/java/org/apache/dolphinscheduler/plugin/datasource/dolphindb/param/DolphinDBDataSourceProcessor.java:
##########
@@ -0,0 +1,180 @@
+package org.apache.dolphinscheduler.plugin.datasource.dolphindb.param;
+
+import org.apache.dolphinscheduler.common.constants.Constants;
+import org.apache.dolphinscheduler.common.constants.DataSourceConstants;
+import org.apache.dolphinscheduler.common.utils.JSONUtils;
+import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
+import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
+import org.apache.dolphinscheduler.plugin.datasource.api.datasource.DataSourceProcessor;
+import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
+import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
+import org.apache.dolphinscheduler.spi.enums.DbType;
+
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import com.google.auto.service.AutoService;
+import com.google.common.collect.Sets;
+
+@AutoService(DataSourceProcessor.class)
+public class DolphinDBDataSourceProcessor extends AbstractDataSourceProcessor {
+
+ private static final Set<String> POSSIBLE_MALICIOUS_KEYS = Sets.newHashSet("allowLoadLocalInfile");
+
+ private static final Pattern PARAMS_PATTER = Pattern.compile("^[a-zA-Z0-9\\-\\_\\/\\@\\.\\:\\,\\ ]+$");
+
+ @Override
+ public BaseDataSourceParamDTO castDatasourceParamDTO(String paramJson) {
+ return JSONUtils.parseObject(paramJson, DolphinDBDataSourceParamDTO.class);
+ }
+
+ @Override
+ public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
+ DolphinDBConnectionParam connectionParams = (DolphinDBConnectionParam) createConnectionParams(connectionJson);
+ DolphinDBDataSourceParamDTO dolphinDBDataSourceParamDTO = new DolphinDBDataSourceParamDTO();
+
+ String[] hostSeperator = connectionParams.getAddress().split(Constants.DOUBLE_SLASH);
+ String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(Constants.COMMA);
+
+ dolphinDBDataSourceParamDTO.setDatabase(connectionParams.getDatabase());
+ dolphinDBDataSourceParamDTO.setUserName(connectionParams.getUser());
+ dolphinDBDataSourceParamDTO.setPassword(connectionParams.getPassword());
+ dolphinDBDataSourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(Constants.COLON)[1]));
Review Comment:
## Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
[Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/3810)
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java:
##########
@@ -333,10 +341,15 @@
String handlerType) throws Exception {
int result = 0;
for (SqlBinds sqlBind : statementsBinds) {
- try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBind)) {
- result = statement.executeUpdate();
- log.info("{} statement execute update result: {}, for sql: {}", handlerType, result,
- sqlBind.getSql());
+ try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBind);) {
+ if (DbType.valueOf(sqlParameters.getType()).equals(DbType.DOLPHINDB)) {
+ statement.executeQuery();
Review Comment:
## Potential database resource leak
This ResultSet is not always closed on method exit.
[Show more details](https://github.com/apache/dolphinscheduler/security/code-scanning/3811)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][datasource-plugin] Add DolphinDB Datasource Plugin [dolphinscheduler]
Posted by "fuchanghai (via GitHub)" <gi...@apache.org>.
fuchanghai commented on code in PR #15324:
URL: https://github.com/apache/dolphinscheduler/pull/15324#discussion_r1427512740
##########
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-dolphindb/src/main/java/org/apache/dolphinscheduler/plugin/datasource/dolphindb/param/DolphinDBDataSourceProcessor.java:
##########
@@ -0,0 +1,180 @@
+package org.apache.dolphinscheduler.plugin.datasource.dolphindb.param;
Review Comment:
plz add following in the header
```
/*
* 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.
*/
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][datasource-plugin] Add DolphinDB Datasource Plugin [dolphinscheduler]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15324:
URL: https://github.com/apache/dolphinscheduler/pull/15324#issuecomment-2087760573
This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][datasource-plugin] Add DolphinDB Datasource Plugin [dolphinscheduler]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #15324: [Feature][datasource-plugin] Add DolphinDB Datasource Plugin
URL: https://github.com/apache/dolphinscheduler/pull/15324
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][datasource-plugin] Add DolphinDB Datasource Plugin [dolphinscheduler]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #15324:
URL: https://github.com/apache/dolphinscheduler/pull/15324#issuecomment-2073698521
This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org