status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/flow/batch/reader/JdbcReader.java
|
@Override
public ValidateResult validateConfig() {
return validate(Arrays.asList(URL, TABLE, USER, PASSWORD));
}
@Override
public void prepare(SparkRuntimeEnvironment prepareEnv) {
}
@Override
public Dataset<Row> read(SparkRuntimeEnvironment env) {
return jdbcReader(env.sparkSession()).load();
}
private DataFrameReader jdbcReader(SparkSession sparkSession) {
DataFrameReader reader = sparkSession.read()
.format(JDBC)
.option(URL, config.getString(URL))
.option(DB_TABLE, config.getString(TABLE))
.option(USER, config.getString(USER))
.option(PASSWORD, config.getString(PASSWORD))
.option(DRIVER, config.getString(DRIVER));
Config jdbcConfig = ConfigUtils.extractSubConfig(config, JDBC + DOTS, false);
if (!config.isEmpty()) {
Map<String, String> optionMap = new HashMap<>(16);
jdbcConfig.entrySet().forEach(x -> optionMap.put(x.getKey(), String.valueOf(x.getValue())));
reader.options(optionMap);
}
return reader;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/flow/batch/writer/JdbcWriter.java
|
/*
* 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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/flow/batch/writer/JdbcWriter.java
|
* limitations under the License.
*/
package org.apache.dolphinscheduler.data.quality.flow.batch.writer;
import static org.apache.dolphinscheduler.data.quality.Constants.APPEND;
import static org.apache.dolphinscheduler.data.quality.Constants.DB_TABLE;
import static org.apache.dolphinscheduler.data.quality.Constants.DRIVER;
import static org.apache.dolphinscheduler.data.quality.Constants.JDBC;
import static org.apache.dolphinscheduler.data.quality.Constants.PASSWORD;
import static org.apache.dolphinscheduler.data.quality.Constants.SAVE_MODE;
import static org.apache.dolphinscheduler.data.quality.Constants.SQL;
import static org.apache.dolphinscheduler.data.quality.Constants.TABLE;
import static org.apache.dolphinscheduler.data.quality.Constants.URL;
import static org.apache.dolphinscheduler.data.quality.Constants.USER;
import org.apache.dolphinscheduler.data.quality.config.Config;
import org.apache.dolphinscheduler.data.quality.config.ValidateResult;
import org.apache.dolphinscheduler.data.quality.execution.SparkRuntimeEnvironment;
import org.apache.dolphinscheduler.data.quality.flow.batch.BatchWriter;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import java.util.Arrays;
import com.google.common.base.Strings;
/**
* JdbcWriter
*/
public class JdbcWriter implements BatchWriter {
private final Config config;
public JdbcWriter(Config config) {
this.config = config;
}
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/flow/batch/writer/JdbcWriter.java
|
public Config getConfig() {
return config;
}
@Override
public ValidateResult validateConfig() {
return validate(Arrays.asList(URL, TABLE, USER, PASSWORD));
}
@Override
public void prepare(SparkRuntimeEnvironment prepareEnv) {
if (Strings.isNullOrEmpty(config.getString(SAVE_MODE))) {
config.put(SAVE_MODE, APPEND);
}
}
@Override
public void write(Dataset<Row> data, SparkRuntimeEnvironment env) {
if (!Strings.isNullOrEmpty(config.getString(SQL))) {
data = env.sparkSession().sql(config.getString(SQL));
}
data.write()
.format(JDBC)
.option(DRIVER, config.getString(DRIVER))
.option(URL, config.getString(URL))
.option(DB_TABLE, config.getString(TABLE))
.option(USER, config.getString(USER))
.option(PASSWORD, config.getString(PASSWORD))
.mode(config.getString(SAVE_MODE))
.save();
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
/*
* 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.apache.dolphinscheduler.plugin.task.dq.utils;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.PARAMETER_BUSINESS_DATE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.PARAMETER_CURRENT_DATE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.PARAMETER_DATETIME;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.AND;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.BATCH;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.CHECK_TYPE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.COMPARISON_NAME;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.COMPARISON_TABLE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.COMPARISON_TYPE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.CREATE_TIME;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.DATABASE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.DATA_TIME;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.DRIVER;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.ERROR_OUTPUT_PATH;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.FAILURE_STRATEGY;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.HDFS_FILE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.INDEX;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.INPUT_TABLE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.OPERATOR;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.OUTPUT_TABLE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.PASSWORD;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.PATH;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.PROCESS_DEFINITION_ID;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.PROCESS_INSTANCE_ID;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.RULE_NAME;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.RULE_TYPE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.SQL;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.SRC_FIELD;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.SRC_FILTER;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.SRC_TABLE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.STATISTICS_EXECUTE_SQL;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.STATISTICS_TABLE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TABLE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TARGET_FIELD;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TARGET_FILTER;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TARGET_TABLE;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TASK_INSTANCE_ID;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.THRESHOLD;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.UPDATE_TIME;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.URL;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.USER;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.task.api.DataQualityTaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.ExecuteSqlType;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.dolphinscheduler.plugin.task.api.utils.MapUtils;
import org.apache.dolphinscheduler.plugin.task.dq.exception.DataQualityException;
import org.apache.dolphinscheduler.plugin.task.dq.rule.entity.DqRuleExecuteSql;
import org.apache.dolphinscheduler.plugin.task.dq.rule.entity.DqRuleInputEntry;
import org.apache.dolphinscheduler.plugin.task.dq.rule.parameter.BaseConfig;
import org.apache.dolphinscheduler.plugin.task.dq.rule.parameter.EnvConfig;
import org.apache.dolphinscheduler.plugin.task.dq.rule.parser.MappingColumn;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.fasterxml.jackson.databind.node.ArrayNode;
/**
* RuleParserUtils
*/
public class RuleParserUtils {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
private RuleParserUtils() {
throw new IllegalStateException("Utility class");
}
private static final String AND_SRC_FILTER = "AND (${src_filter})";
private static final String WHERE_SRC_FILTER = "WHERE (${src_filter})";
private static final String AND_TARGET_FILTER = "AND (${target_filter})";
private static final String WHERE_TARGET_FILTER = "WHERE (${target_filter})";
public static List<BaseConfig> getReaderConfigList(
Map<String, String> inputParameterValue,
DataQualityTaskExecutionContext dataQualityTaskExecutionContext) throws DataQualityException {
List<BaseConfig> readerConfigList = new ArrayList<>();
if (StringUtils.isNotEmpty(dataQualityTaskExecutionContext.getSourceConnectorType())) {
BaseConnectionParam sourceDataSource =
(BaseConnectionParam) DataSourceUtils.buildConnectionParams(
DbType.of(dataQualityTaskExecutionContext.getSourceType()),
dataQualityTaskExecutionContext.getSourceConnectionParams());
BaseConfig sourceBaseConfig = new BaseConfig();
sourceBaseConfig.setType(dataQualityTaskExecutionContext.getSourceConnectorType());
Map<String, Object> config = new HashMap<>();
if (sourceDataSource != null) {
config.put(DATABASE, sourceDataSource.getDatabase());
config.put(TABLE, inputParameterValue.get(SRC_TABLE));
config.put(URL, DataSourceUtils.getJdbcUrl(DbType.of(dataQualityTaskExecutionContext.getSourceType()),
sourceDataSource));
config.put(USER, sourceDataSource.getUser());
config.put(PASSWORD, sourceDataSource.getPassword());
config.put(DRIVER, DataSourceUtils
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
.getDatasourceDriver(DbType.of(dataQualityTaskExecutionContext.getSourceType())));
String outputTable = sourceDataSource.getDatabase() + "_" + inputParameterValue.get(SRC_TABLE);
config.put(OUTPUT_TABLE, outputTable);
inputParameterValue.put(SRC_TABLE, outputTable);
}
sourceBaseConfig.setConfig(config);
readerConfigList.add(sourceBaseConfig);
}
if (StringUtils.isNotEmpty(dataQualityTaskExecutionContext.getTargetConnectorType())) {
BaseConnectionParam targetDataSource =
(BaseConnectionParam) DataSourceUtils.buildConnectionParams(
DbType.of(dataQualityTaskExecutionContext.getTargetType()),
dataQualityTaskExecutionContext.getTargetConnectionParams());
BaseConfig targetBaseConfig = new BaseConfig();
targetBaseConfig.setType(dataQualityTaskExecutionContext.getTargetConnectorType());
Map<String, Object> config = new HashMap<>();
if (targetDataSource != null) {
config.put(DATABASE, targetDataSource.getDatabase());
config.put(TABLE, inputParameterValue.get(TARGET_TABLE));
config.put(URL, DataSourceUtils.getJdbcUrl(DbType.of(dataQualityTaskExecutionContext.getTargetType()),
targetDataSource));
config.put(USER, targetDataSource.getUser());
config.put(PASSWORD, targetDataSource.getPassword());
config.put(DRIVER, DataSourceUtils
.getDatasourceDriver(DbType.of(dataQualityTaskExecutionContext.getTargetType())));
String outputTable = targetDataSource.getDatabase() + "_" + inputParameterValue.get(TARGET_TABLE);
config.put(OUTPUT_TABLE, outputTable);
inputParameterValue.put(TARGET_TABLE, outputTable);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
targetBaseConfig.setConfig(config);
readerConfigList.add(targetBaseConfig);
}
return readerConfigList;
}
public static int replaceExecuteSqlPlaceholder(List<DqRuleExecuteSql> executeSqlList,
int index, Map<String, String> inputParameterValueResult,
List<BaseConfig> transformerConfigList) {
List<DqRuleExecuteSql> midExecuteSqlDefinitionList =
getExecuteSqlListByType(executeSqlList, ExecuteSqlType.MIDDLE);
List<DqRuleExecuteSql> statisticsExecuteSqlDefinitionList =
getExecuteSqlListByType(executeSqlList, ExecuteSqlType.STATISTICS);
checkAndReplace(midExecuteSqlDefinitionList, inputParameterValueResult.get(SRC_FILTER), AND_SRC_FILTER);
checkAndReplace(midExecuteSqlDefinitionList, inputParameterValueResult.get(SRC_FILTER), WHERE_SRC_FILTER);
checkAndReplace(statisticsExecuteSqlDefinitionList, inputParameterValueResult.get(SRC_FILTER), AND_SRC_FILTER);
checkAndReplace(statisticsExecuteSqlDefinitionList, inputParameterValueResult.get(SRC_FILTER),
WHERE_SRC_FILTER);
checkAndReplace(midExecuteSqlDefinitionList, inputParameterValueResult.get(TARGET_FILTER), AND_TARGET_FILTER);
checkAndReplace(midExecuteSqlDefinitionList, inputParameterValueResult.get(TARGET_FILTER), WHERE_TARGET_FILTER);
checkAndReplace(statisticsExecuteSqlDefinitionList, inputParameterValueResult.get(TARGET_FILTER),
AND_TARGET_FILTER);
checkAndReplace(statisticsExecuteSqlDefinitionList, inputParameterValueResult.get(TARGET_FILTER),
WHERE_TARGET_FILTER);
if (CollectionUtils.isNotEmpty(midExecuteSqlDefinitionList)) {
for (DqRuleExecuteSql executeSqlDefinition : midExecuteSqlDefinitionList) {
index = setTransformerConfig(
index,
inputParameterValueResult,
transformerConfigList,
executeSqlDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
}
}
if (CollectionUtils.isNotEmpty(statisticsExecuteSqlDefinitionList)) {
for (DqRuleExecuteSql executeSqlDefinition : statisticsExecuteSqlDefinitionList) {
index = setTransformerConfig(
index,
inputParameterValueResult,
transformerConfigList,
executeSqlDefinition);
}
}
return index;
}
private static int setTransformerConfig(int index,
Map<String, String> inputParameterValueResult,
List<BaseConfig> transformerConfigList,
DqRuleExecuteSql executeSqlDefinition) {
Map<String, Object> config = new HashMap<>();
config.put(INDEX, index++);
config.put(SQL,
ParameterUtils.convertParameterPlaceholders(executeSqlDefinition.getSql(), inputParameterValueResult));
config.put(OUTPUT_TABLE, executeSqlDefinition.getTableAlias());
BaseConfig transformerConfig = new BaseConfig(SQL, config);
transformerConfigList.add(transformerConfig);
return index;
}
public static List<BaseConfig> getSingleTableCustomSqlTransformerConfigList(int index,
Map<String, String> inputParameterValueResult) {
List<BaseConfig> list = new ArrayList<>();
Map<String, Object> config = new HashMap<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
config.put(INDEX, index + 1);
config.put(SQL, ParameterUtils.convertParameterPlaceholders(
inputParameterValueResult.get(STATISTICS_EXECUTE_SQL), inputParameterValueResult));
config.put(OUTPUT_TABLE, inputParameterValueResult.get(SRC_TABLE));
inputParameterValueResult.put(STATISTICS_TABLE, inputParameterValueResult.get(SRC_TABLE));
BaseConfig transformerConfig = new BaseConfig(SQL, config);
list.add(transformerConfig);
return list;
}
private static String getCoalesceString(String table, String column) {
return "coalesce(" + table + "." + column + ", '')";
}
private static String getSrcColumnIsNullStr(String table, List<String> columns) {
String[] columnList = new String[columns.size()];
for (int i = 0; i < columns.size(); i++) {
String column = columns.get(i);
columnList[i] = table + "." + column + " IS NULL";
}
return String.join(AND, columnList);
}
public static Map<String, String> getInputParameterMapFromEntryList(List<DqRuleInputEntry> defaultInputEntryList) {
Map<String, String> defaultInputParameterValue = new HashMap<>();
for (DqRuleInputEntry inputEntry : defaultInputEntryList) {
defaultInputParameterValue.put(inputEntry.getField(), inputEntry.getValue());
}
return defaultInputParameterValue;
}
public static List<BaseConfig> getWriterConfigList(
String sql,
DataQualityTaskExecutionContext dataQualityTaskExecutionContext) throws DataQualityException {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
List<BaseConfig> writerConfigList = new ArrayList<>();
if (StringUtils.isNotEmpty(dataQualityTaskExecutionContext.getWriterConnectorType())) {
BaseConnectionParam writerDataSource =
(BaseConnectionParam) DataSourceUtils.buildConnectionParams(
DbType.of(dataQualityTaskExecutionContext.getWriterType()),
dataQualityTaskExecutionContext.getWriterConnectionParams());
BaseConfig writerConfig = new BaseConfig();
writerConfig.setType(dataQualityTaskExecutionContext.getWriterConnectorType());
Map<String, Object> config = new HashMap<>();
if (writerDataSource != null) {
config.put(DATABASE, writerDataSource.getDatabase());
config.put(TABLE, dataQualityTaskExecutionContext.getWriterTable());
config.put(URL, DataSourceUtils.getJdbcUrl(DbType.of(dataQualityTaskExecutionContext.getWriterType()),
writerDataSource));
config.put(USER, writerDataSource.getUser());
config.put(PASSWORD, writerDataSource.getPassword());
config.put(DRIVER, DataSourceUtils
.getDatasourceDriver(DbType.of(dataQualityTaskExecutionContext.getWriterType())));
config.put(SQL, sql);
}
writerConfig.setConfig(config);
writerConfigList.add(writerConfig);
}
return writerConfigList;
}
public static void addStatisticsValueTableReaderConfig(List<BaseConfig> readerConfigList,
DataQualityTaskExecutionContext dataQualityTaskExecutionContext) {
if (dataQualityTaskExecutionContext.isComparisonNeedStatisticsValueTable()) {
List<BaseConfig> statisticsBaseConfigList =
RuleParserUtils.getStatisticsValueConfigReaderList(dataQualityTaskExecutionContext);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
readerConfigList.addAll(statisticsBaseConfigList);
}
}
public static List<BaseConfig> getStatisticsValueConfigWriterList(
String sql,
Map<String, String> inputParameterValueResult,
DataQualityTaskExecutionContext dataQualityTaskExecutionContext) throws DataQualityException {
List<BaseConfig> writerConfigList = new ArrayList<>();
if (StringUtils.isNotEmpty(dataQualityTaskExecutionContext.getStatisticsValueConnectorType())) {
BaseConfig writerConfig = getStatisticsValueConfig(dataQualityTaskExecutionContext);
if (writerConfig != null) {
writerConfig.getConfig().put(SQL,
ParameterUtils.convertParameterPlaceholders(sql, inputParameterValueResult));
}
writerConfigList.add(writerConfig);
}
return writerConfigList;
}
public static List<BaseConfig> getStatisticsValueConfigReaderList(
DataQualityTaskExecutionContext dataQualityTaskExecutionContext) throws DataQualityException {
List<BaseConfig> readerConfigList = new ArrayList<>();
if (StringUtils.isNotEmpty(dataQualityTaskExecutionContext.getStatisticsValueConnectorType())) {
BaseConfig readerConfig = getStatisticsValueConfig(dataQualityTaskExecutionContext);
if (readerConfig != null) {
readerConfig.getConfig().put(OUTPUT_TABLE, dataQualityTaskExecutionContext.getStatisticsValueTable());
}
readerConfigList.add(readerConfig);
}
return readerConfigList;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
public static BaseConfig getStatisticsValueConfig(
DataQualityTaskExecutionContext dataQualityTaskExecutionContext) throws DataQualityException {
BaseConfig baseConfig = null;
if (StringUtils.isNotEmpty(dataQualityTaskExecutionContext.getStatisticsValueConnectorType())) {
BaseConnectionParam writerDataSource =
(BaseConnectionParam) DataSourceUtils.buildConnectionParams(
DbType.of(dataQualityTaskExecutionContext.getStatisticsValueType()),
dataQualityTaskExecutionContext.getStatisticsValueWriterConnectionParams());
baseConfig = new BaseConfig();
baseConfig.setType(dataQualityTaskExecutionContext.getStatisticsValueConnectorType());
Map<String, Object> config = new HashMap<>();
if (writerDataSource != null) {
config.put(DATABASE, writerDataSource.getDatabase());
config.put(TABLE, dataQualityTaskExecutionContext.getStatisticsValueTable());
config.put(URL, DataSourceUtils.getJdbcUrl(
DbType.of(dataQualityTaskExecutionContext.getStatisticsValueType()), writerDataSource));
config.put(USER, writerDataSource.getUser());
config.put(PASSWORD, writerDataSource.getPassword());
config.put(DRIVER, DataSourceUtils
.getDatasourceDriver(DbType.of(dataQualityTaskExecutionContext.getWriterType())));
}
baseConfig.setConfig(config);
}
return baseConfig;
}
public static String getOnClause(List<MappingColumn> mappingColumnList,
Map<String, String> inputParameterValueResult) {
String[] columnList = new String[mappingColumnList.size()];
for (int i = 0; i < mappingColumnList.size(); i++) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
MappingColumn column = mappingColumnList.get(i);
columnList[i] = getCoalesceString(inputParameterValueResult.get(SRC_TABLE), column.getSrcField())
+ column.getOperator()
+ getCoalesceString(inputParameterValueResult.get(TARGET_TABLE), column.getTargetField());
}
return String.join(AND, columnList);
}
public static String getWhereClause(List<MappingColumn> mappingColumnList,
Map<String, String> inputParameterValueResult) {
String srcColumnNotNull = "( NOT ("
+ getSrcColumnIsNullStr(inputParameterValueResult.get(SRC_TABLE), getSrcColumnList(mappingColumnList))
+ " ))";
String targetColumnIsNull = "( " + getSrcColumnIsNullStr(inputParameterValueResult.get(TARGET_TABLE),
getTargetColumnList(mappingColumnList)) + " )";
return srcColumnNotNull + AND + targetColumnIsNull;
}
public static List<BaseConfig> getWriterConfigList(
int index,
Map<String, String> inputParameterValueResult,
List<BaseConfig> transformerConfigList,
DataQualityTaskExecutionContext dataQualityTaskExecutionContext,
String writerSql) throws DataQualityException {
List<DqRuleExecuteSql> comparisonExecuteSqlList =
getExecuteSqlListByType(
JSONUtils.toList(dataQualityTaskExecutionContext.getExecuteSqlList(), DqRuleExecuteSql.class),
ExecuteSqlType.COMPARISON);
if (CollectionUtils.isNotEmpty(comparisonExecuteSqlList)) {
DqRuleExecuteSql comparisonSql = comparisonExecuteSqlList.get(0);
inputParameterValueResult.put(COMPARISON_TABLE, comparisonSql.getTableAlias());
checkAndReplace(comparisonExecuteSqlList, inputParameterValueResult.get(SRC_FILTER), AND_SRC_FILTER);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
checkAndReplace(comparisonExecuteSqlList, inputParameterValueResult.get(SRC_FILTER), WHERE_SRC_FILTER);
checkAndReplace(comparisonExecuteSqlList, inputParameterValueResult.get(TARGET_FILTER), AND_TARGET_FILTER);
checkAndReplace(comparisonExecuteSqlList, inputParameterValueResult.get(TARGET_FILTER),
WHERE_TARGET_FILTER);
for (DqRuleExecuteSql executeSqlDefinition : comparisonExecuteSqlList) {
index = setTransformerConfig(
index,
inputParameterValueResult,
transformerConfigList,
executeSqlDefinition);
}
}
return getWriterConfigList(
ParameterUtils.convertParameterPlaceholders(writerSql, inputParameterValueResult),
dataQualityTaskExecutionContext);
}
public static List<BaseConfig> getAllWriterConfigList(
Map<String, String> inputParameterValue,
DataQualityTaskExecutionContext context,
int index,
List<BaseConfig> transformerConfigList,
String writerSql,
String statisticsValueWriterSql) {
List<BaseConfig> writerConfigList = RuleParserUtils.getWriterConfigList(
index,
inputParameterValue,
transformerConfigList,
context,
writerSql);
writerConfigList.addAll(
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
RuleParserUtils.getStatisticsValueConfigWriterList(
statisticsValueWriterSql,
inputParameterValue,
context));
BaseConfig errorOutputWriter = RuleParserUtils.getErrorOutputWriter(inputParameterValue, context);
if (errorOutputWriter != null) {
writerConfigList.add(errorOutputWriter);
}
return writerConfigList;
}
public static List<DqRuleExecuteSql> getExecuteSqlListByType(
List<DqRuleExecuteSql> allExecuteSqlList,
ExecuteSqlType executeSqlType) {
if (CollectionUtils.isEmpty(allExecuteSqlList)) {
return allExecuteSqlList;
}
return allExecuteSqlList
.stream()
.filter(x -> ExecuteSqlType.of(x.getType()) == executeSqlType)
.collect(Collectors.toList());
}
private static void checkAndReplace(List<DqRuleExecuteSql> list, String checkValue, String replaceSrc) {
if (StringUtils.isEmpty(checkValue) && CollectionUtils.isNotEmpty(list)) {
for (DqRuleExecuteSql executeSqlDefinition : list) {
String sql = executeSqlDefinition.getSql();
sql = sql.replace(replaceSrc, "");
executeSqlDefinition.setSql(sql);
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
public static List<MappingColumn> getMappingColumnList(String mappingColumns) {
ArrayNode mappingColumnList = JSONUtils.parseArray(mappingColumns);
List<MappingColumn> list = new ArrayList<>();
mappingColumnList.forEach(item -> {
MappingColumn column = new MappingColumn(
String.valueOf(item.get(SRC_FIELD)).replace("\"", ""),
String.valueOf(item.get(OPERATOR)).replace("\"", " "),
String.valueOf(item.get(TARGET_FIELD)).replace("\"", ""));
list.add(column);
});
return list;
}
public static List<String> getSrcColumnList(List<MappingColumn> mappingColumns) {
List<String> list = new ArrayList<>();
mappingColumns.forEach(item -> list.add(item.getSrcField()));
return list;
}
public static List<String> getTargetColumnList(List<MappingColumn> mappingColumns) {
List<String> list = new ArrayList<>();
mappingColumns.forEach(item -> list.add(item.getTargetField()));
return list;
}
public static EnvConfig getEnvConfig() {
EnvConfig envConfig = new EnvConfig();
envConfig.setType(BATCH);
return envConfig;
}
public static BaseConfig getErrorOutputWriter(Map<String, String> inputParameterValueResult,
DataQualityTaskExecutionContext dataQualityTaskExecutionContext) {
List<DqRuleExecuteSql> dqRuleExecuteSqlList =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
JSONUtils.toList(dataQualityTaskExecutionContext.getExecuteSqlList(), DqRuleExecuteSql.class);
DqRuleExecuteSql errorOutputSql = null;
if (CollectionUtils.isEmpty(dqRuleExecuteSqlList)) {
return null;
}
for (DqRuleExecuteSql executeSql : dqRuleExecuteSqlList) {
if (executeSql.isErrorOutputSql()) {
errorOutputSql = executeSql;
break;
}
}
BaseConfig baseConfig = null;
if (StringUtils.isNotEmpty(inputParameterValueResult.get(ERROR_OUTPUT_PATH))
&& errorOutputSql != null) {
baseConfig = new BaseConfig();
Map<String, Object> config = new HashMap<>();
config.put(PATH, inputParameterValueResult.get(ERROR_OUTPUT_PATH));
config.put(INPUT_TABLE, errorOutputSql.getTableAlias());
baseConfig.setConfig(config);
baseConfig.setType(HDFS_FILE);
}
return baseConfig;
}
/**
* the unique code use to get the same type and condition task statistics value
* @param inputParameterValue
* @return
*/
public static String generateUniqueCode(Map<String, String> inputParameterValue) {
if (MapUtils.isEmpty(inputParameterValue)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,639 |
[Bug] [DataQuality] Dataquality Spark Get Datasource Password Error When Password Has $
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When Datasource has a password has $, running the Data quality job will fail, Data quality Spark job will get the wrong password and cannot connect.
### What you expected to happen
Running as expected.
### How to reproduce
When I have a Datasource like the below:
```
"user": "ds",
"password": "d$dfdf$sadfasdf",
"address": "jdbc:mysql://test.com:3306",
"database": "ds",
"jdbcUrl": "jdbc:mysql://test.com:3306/ds",
"driverClassName": "com.mysql.cj.jdbc.Driver",
"validationQuery": "select 1",
"other": "enabledTLSProtocols=TLSv1.2&useSSL=true&",
"props": {
"enabledTLSProtocols": "TLSv1.2",
"useSSL": "true"
}
```
The password is `d$dfdf$sadfasdf`
And run data quality job command will like the blow:
root@dolphinscheduler-worker-0:/opt/dolphinscheduler# ${SPARK_HOME2}/bin/spark-submit --master local --driver-cores 1 --driver-memory 512M --num-executors 2 --executor-cores 2 --executor-memory 2G --conf spark.yarn.maxAppAttempts=1 --class org.apache.dolphinscheduler.data.quality.DataQualityApplication --jars /opt/dolphinscheduler/libs/mysql-connector-java-8.0.16.jar,/opt/dolphinscheduler/libs/hadoop-aws-2.9.2.jar,/opt/dolphinscheduler/libs/aws-core-2.17.232.jar,/opt/dolphinscheduler/libs/aws-java-sdk-s3-1.12.160.jar,/opt/dolphinscheduler/libs/aws-java-sdk-core-1.12.160.jar,/opt/dolphinscheduler/libs/kyuubi-hive-jdbc-1.6.0-incubating.jar,/opt/dolphinscheduler/libs/libthrift-0.9.3.jar /opt/dolphinscheduler/libs/dolphinscheduler-data-quality-3.1.2-SNAPSHOT.jar "{\"name\":\"$t(table_count_check)\",\"env\":{\"type\":\"batch\",\"config\":null},\"readers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_t_ds_version\",\"table\":\"t_ds_version\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"auth\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"output_table\":\"ds_data_related_policy\",\"table\":\"data_related_policy\",\"url\":\"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\"} }],\"transformers\":[{\"type\":\"sql\",\"config\":{\"index\":1,\"output_table\":\"table_count\",\"sql\":\"SELECT COUNT(*) AS total FROM ds_t_ds_version \"} }],\"writers\":[{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_execute_result\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as rule_type,'$t(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count \"} },{\"type\":\"JDBC\",\"config\":{\"database\":\"ds\",\"password\":\"d$dfdf$sadfasdf\",\"driver\":\"com.mysql.cj.jdbc.Driver\",\"user\":\"ds\",\"table\":\"t_ds_dq_task_statistics_value\",\"url\":\"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false\",\"sql\":\"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count\"} }]}"
And I print the arg[0] in here
https://github.com/apache/dolphinscheduler/blob/9668c84d30b2c885cbf20ccf9e76f64a41f77096/dolphinscheduler-data-quality/src/main/java/org/apache/dolphinscheduler/data/quality/DataQualityApplication.java#L42-L49
I will get the arg:
{"name":"(table_count_check)","env":{"type":"batch","config":null},"readers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_t_ds_version","table":"t_ds_version","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} },{"type":"JDBC","config":{"database":"auth","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","output_table":"ds_data_related_policy","table":"data_related_policy","url":"jdbc:mysql://test.com:3306/ds?enabledTLSProtocols=TLSv1.2&useSSL=true&&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"} }],"transformers":[{"type":"sql","config":{"index":1,"output_table":"table_count","sql":"SELECT COUNT(*) AS total FROM ds_t_ds_version "} }],"writers":[{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_execute_result","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as rule_type,'(table_count_check)' as rule_name,0 as process_definition_id,233064 as process_instance_id,270001 as task_instance_id,table_count.total AS statistics_value,2 AS comparison_value,1 AS comparison_type,0 as check_type,2 as threshold,0 as operator,0 as failure_strategy,'hdfs://mycluster:8020/user/dolphinscheduler/data_quality_error_data/0_233064_test' as error_output_path,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count "} },{"type":"JDBC","config":{"database":"ds","password":"d","driver":"com.mysql.cj.jdbc.Driver","user":"ds","table":"t_ds_dq_task_statistics_value","url":"jdbc:mysql://test.com:3306/ds?characterEncoding=utf8&useSSL=true&allowMultiQueries=true&rewriteBatchedStatements=true&autoreconnect=true&enabledTLSProtocols=TLSv1.2&allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false","sql":"select 0 as process_definition_id,270001 as task_instance_id,10 as rule_id,'EOHXEHAM25BPOQ5WD+AFF52I3CT78L3VCC6V97Y1N44=' as unique_code,'table_count.total'AS statistics_name,table_count.total AS statistics_value,'2023-02-27 07:49:32' as data_time,'2023-02-27 07:49:32' as create_time,'2023-02-27 07:49:32' as update_time from table_count"} }]}
And the password change to `d`
### Anything else
It looks like character $ will be escaped by the system, I will fix this bug.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13639
|
https://github.com/apache/dolphinscheduler/pull/13643
|
7586710d49ea86a22798a3f401a875e2f8669dbc
|
43d79e45b4b5d81e4066ab2d4e2a96063ed85316
| 2023-02-27T10:01:15Z |
java
| 2023-02-28T10:50:44Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-dataquality/src/main/java/org/apache/dolphinscheduler/plugin/task/dq/utils/RuleParserUtils.java
|
return "-1";
}
Map<String, String> newInputParameterValue = new HashMap<>(inputParameterValue);
newInputParameterValue.remove(RULE_TYPE);
newInputParameterValue.remove(RULE_NAME);
newInputParameterValue.remove(CREATE_TIME);
newInputParameterValue.remove(UPDATE_TIME);
newInputParameterValue.remove(PROCESS_DEFINITION_ID);
newInputParameterValue.remove(PROCESS_INSTANCE_ID);
newInputParameterValue.remove(TASK_INSTANCE_ID);
newInputParameterValue.remove(CHECK_TYPE);
newInputParameterValue.remove(OPERATOR);
newInputParameterValue.remove(THRESHOLD);
newInputParameterValue.remove(FAILURE_STRATEGY);
newInputParameterValue.remove(DATA_TIME);
newInputParameterValue.remove(ERROR_OUTPUT_PATH);
newInputParameterValue.remove(COMPARISON_TYPE);
newInputParameterValue.remove(COMPARISON_NAME);
newInputParameterValue.remove(COMPARISON_TABLE);
newInputParameterValue.remove(PARAMETER_CURRENT_DATE);
newInputParameterValue.remove(PARAMETER_BUSINESS_DATE);
newInputParameterValue.remove(PARAMETER_DATETIME);
StringBuilder sb = new StringBuilder();
for (String value : newInputParameterValue.values()) {
sb.append(value);
}
return Md5Utils.getMd5(sb.toString(), true);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
/*
* 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.apache.dolphinscheduler.api.service;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.PROJECT;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.PROJECT_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.PROJECT_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.PROJECT_UPDATE;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService;
import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl;
import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.ProjectUser;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
import java.util.Set;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* project service test
**/
@ExtendWith(MockitoExtension.class)
@MockitoSettings(strictness = Strictness.LENIENT)
public class ProjectServiceTest {
private static final Logger logger = LoggerFactory.getLogger(ProjectServiceTest.class);
private static final Logger baseServiceLogger = LoggerFactory.getLogger(BaseServiceImpl.class);
private static final Logger projectLogger = LoggerFactory.getLogger(ProjectServiceImpl.class);
@InjectMocks
private ProjectServiceImpl projectService;
@Mock
private ProjectMapper projectMapper;
@Mock
private ProjectUserMapper projectUserMapper;
@Mock
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
private ProcessDefinitionMapper processDefinitionMapper;
@Mock
private UserMapper userMapper;
@Mock
private ResourcePermissionCheckService resourcePermissionCheckService;
@Mock
private TaskGroupService taskGroupService;
private String projectName = "ProjectServiceTest";
private String userName = "ProjectServiceTest";
@Test
public void testCreateProject() {
User loginUser = getLoginUser();
loginUser.setId(1);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS, 1,
PROJECT_CREATE, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS, null, 1,
baseServiceLogger)).thenReturn(true);
Result result = projectService.createProject(loginUser, projectName, getDesc());
logger.info(result.toString());
Assertions.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode(), 10001);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject());
result = projectService.createProject(loginUser, projectName, projectName);
logger.info(result.toString());
Assertions.assertEquals(Status.PROJECT_ALREADY_EXISTS.getCode(), result.getCode().intValue());
Mockito.when(projectMapper.insert(Mockito.any(Project.class))).thenReturn(1);
result = projectService.createProject(loginUser, "test", "test");
logger.info(result.toString());
Assertions.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
}
@Test
public void testCheckProjectAndAuth() {
long projectCode = 1L;
User loginUser = getLoginUser();
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, null, projectCode, PROJECT);
logger.info(result.toString());
Status status = (Status) result.get(Constants.STATUS);
Assertions.assertEquals(Status.PROJECT_NOT_EXIST, result.get(Constants.STATUS));
Project project = getProject();
project.setUserId(2);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode, PROJECT);
logger.info(result.toString());
Assertions.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM, result.get(Constants.STATUS));
project.setUserId(1);
loginUser.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
project.getUserId(), PROJECT, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS,
new Object[]{project.getId()},
0, baseServiceLogger)).thenReturn(true);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode, PROJECT);
logger.info(result.toString());
Assertions.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Map<String, Object> result2 = new HashMap<>();
result2 = projectService.checkProjectAndAuth(loginUser, null, projectCode, PROJECT);
Assertions.assertEquals(Status.PROJECT_NOT_EXIST, result2.get(Constants.STATUS));
Project project1 = getProject();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
project1.setUserId(2);
loginUser.setUserType(UserType.GENERAL_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
loginUser.getId(), PROJECT, baseServiceLogger)).thenReturn(true);
result2 = projectService.checkProjectAndAuth(loginUser, project1, projectCode, PROJECT);
Assertions.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM, result2.get(Constants.STATUS));
project1.setUserId(1);
projectService.checkProjectAndAuth(loginUser, project1, projectCode, PROJECT);
}
@Test
public void testHasProjectAndPerm() {
User loginUser = getLoginUser();
Project project = getProject();
Map<String, Object> result = new HashMap<>();
User tempUser = new User();
tempUser.setId(Integer.MAX_VALUE);
tempUser.setUserType(UserType.GENERAL_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
tempUser.getId(), null, baseServiceLogger)).thenReturn(true);
boolean checkResult = projectService.hasProjectAndPerm(tempUser, project, result, null);
logger.info(result.toString());
Assertions.assertFalse(checkResult);
result = new HashMap<>();
project.setUserId(1);
loginUser.setUserType(UserType.ADMIN_USER);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
loginUser.getId(), null, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS,
new Object[]{project.getId()},
0, baseServiceLogger)).thenReturn(true);
checkResult = projectService.hasProjectAndPerm(loginUser, project, result, null);
logger.info(result.toString());
Assertions.assertTrue(checkResult);
}
@Test
public void testQueryProjectWithAuthorizedLevelListPaging() {
IPage<Project> page = new Page<>(1, 10);
page.setTotal(1L);
page.setRecords(getList());
User loginUser = getLoginUser();
Integer pageSize = 10;
Integer pageNo = 1;
String searchVal = "testVal";
Result result = new Result();
Mockito.when(projectMapper.queryProjectListPaging(any(Page.class), Mockito.anyList(), eq(searchVal)))
.thenReturn(page);
Set<Integer> allProjectIds = new HashSet();
allProjectIds.add(1);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS,
loginUser.getId(), projectLogger)).thenReturn(allProjectIds);
result = projectService.queryProjectWithAuthorizedLevelListPaging(loginUser.getId(), loginUser, pageSize,
pageNo, searchVal);
logger.info(result.toString());
PageInfo<Project> pageInfo = (PageInfo<Project>) result.getData();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
Assertions.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getTotalList()));
}
@Test
public void testHasProjectAndWritePerm() {
User loginUser = getLoginUser();
Project project = getProject();
Map<String, Object> result = new HashMap<>();
User tempUser = new User();
tempUser.setId(Integer.MAX_VALUE);
tempUser.setUserType(UserType.GENERAL_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
tempUser.getId(), null, baseServiceLogger)).thenReturn(true);
boolean checkResult = projectService.hasProjectAndWritePerm(tempUser, project, result);
logger.info(result.toString());
Assertions.assertFalse(checkResult);
result = new HashMap<>();
project.setUserId(1);
loginUser.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
loginUser.getId(), null, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS,
new Object[]{project.getId()},
0, baseServiceLogger)).thenReturn(true);
checkResult = projectService.hasProjectAndWritePerm(loginUser, project, result);
logger.info(result.toString());
Assertions.assertTrue(checkResult);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
@Test
public void testDeleteProject() {
User loginUser = getLoginUser();
Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject());
Mockito.when(
resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS, loginUser.getId(),
PROJECT_DELETE, baseServiceLogger))
.thenReturn(true);
Result result = projectService.deleteProject(loginUser, 11L);
logger.info(result.toString());
Assertions.assertTrue(Status.PROJECT_NOT_FOUND.getCode() == result.getCode());
loginUser.setId(2);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS, new Object[]{1},
loginUser.getId(),
baseServiceLogger)).thenReturn(true);
result = projectService.deleteProject(loginUser, 1L);
logger.info(result.toString());
Assertions.assertTrue(Status.USER_NO_WRITE_PROJECT_PERM.getCode() == result.getCode());
Mockito.when(processDefinitionMapper.queryAllDefinitionList(1L)).thenReturn(getProcessDefinitions());
loginUser.setUserType(UserType.ADMIN_USER);
loginUser.setId(1);
Mockito.when(
resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS, new Object[]{1}, 0,
baseServiceLogger))
.thenReturn(true);
result = projectService.deleteProject(loginUser, 1L);
logger.info(result.toString());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
Assertions.assertTrue(Status.DELETE_PROJECT_ERROR_DEFINES_NOT_NULL.getCode() == result.getCode());
Mockito.when(projectMapper.deleteById(1)).thenReturn(1);
Mockito.when(processDefinitionMapper.queryAllDefinitionList(1L)).thenReturn(new ArrayList<>());
result = projectService.deleteProject(loginUser, 1L);
logger.info(result.toString());
Assertions.assertTrue(Status.SUCCESS.getCode() == result.getCode());
}
@Test
public void testUpdate() {
User loginUser = getLoginUser();
loginUser.setId(1);
Project project = getProject();
project.setCode(2L);
Mockito.when(
resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS, loginUser.getId(),
PROJECT_UPDATE, baseServiceLogger))
.thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS, new Object[]{1},
loginUser.getId(),
baseServiceLogger)).thenReturn(true);
Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project);
Mockito.when(projectMapper.queryByCode(2L)).thenReturn(getProject());
Result result = projectService.update(loginUser, 1L, projectName, "desc", "testUser");
logger.info(result.toString());
Assertions.assertTrue(Status.PROJECT_NOT_FOUND.getCode() == result.getCode());
result = projectService.update(loginUser, 2L, projectName, "desc", userName);
logger.info(result.toString());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
Assertions.assertTrue(Status.PROJECT_ALREADY_EXISTS.getCode() == result.getCode());
Mockito.when(userMapper.queryByUserNameAccurately(Mockito.any())).thenReturn(null);
result = projectService.update(loginUser, 2L, "test", "desc", "testuser");
Assertions.assertTrue(Status.USER_NOT_EXIST.getCode() == result.getCode());
Mockito.when(userMapper.queryByUserNameAccurately(Mockito.any())).thenReturn(new User());
project.setUserId(1);
Mockito.when(projectMapper.updateById(Mockito.any(Project.class))).thenReturn(1);
result = projectService.update(loginUser, 2L, "test", "desc", "testUser");
logger.info(result.toString());
Assertions.assertTrue(Status.SUCCESS.getCode() == result.getCode());
}
@Test
public void testQueryAuthorizedProject() {
Mockito.when(projectMapper.queryAuthedProjectListByUserId(2)).thenReturn(getList());
User loginUser = getLoginUser();
loginUser.setUserType(UserType.ADMIN_USER);
Result result = projectService.queryAuthorizedProject(loginUser, 2);
logger.info(result.toString());
List<Project> projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
loginUser.setUserType(UserType.GENERAL_USER);
loginUser.setId(3);
result = projectService.queryAuthorizedProject(loginUser, 2);
projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
}
@Test
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
public void testQueryAuthorizedUser() {
final User loginUser = this.getLoginUser();
Result result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L);
logger.info("FAILURE 1: {}", result.toString());
Assertions.assertTrue(Status.PROJECT_NOT_FOUND.getCode() == result.getCode());
loginUser.setId(100);
Mockito.when(this.projectMapper.queryByCode(Mockito.anyLong())).thenReturn(this.getProject());
result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L);
logger.info("FAILURE 2: {}", result.toString());
Assertions.assertTrue(Status.USER_NO_OPERATION_PROJECT_PERM.getCode() == result.getCode());
loginUser.setUserType(UserType.ADMIN_USER);
Mockito.when(
resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
loginUser.getId(), PROJECT, baseServiceLogger))
.thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS, new Object[]{1},
0, baseServiceLogger)).thenReturn(true);
Mockito.when(this.userMapper.queryAuthedUserListByProjectId(1)).thenReturn(this.getUserList());
result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L);
logger.info("SUCCESS 1: {}", result.toString());
List<User> users = (List<User>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(users));
loginUser.setId(1);
loginUser.setUserType(UserType.GENERAL_USER);
Mockito.when(
resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.PROJECTS,
loginUser.getId(), PROJECT, baseServiceLogger))
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
.thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.PROJECTS, new Object[]{1},
1, baseServiceLogger)).thenReturn(true);
result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L);
logger.info("SUCCESS 2: {}", result.toString());
users = (List<User>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(users));
}
@Test
public void testQueryCreatedProject() {
User loginUser = getLoginUser();
Mockito.when(projectMapper.queryProjectCreatedByUser(1)).thenReturn(getList());
loginUser.setUserType(UserType.ADMIN_USER);
Map<String, Object> result = projectService.queryProjectCreatedByUser(loginUser);
logger.info(result.toString());
List<Project> projects = (List<Project>) result.get(Constants.DATA_LIST);
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
}
@Test
public void testQueryProjectCreatedAndAuthorizedByUser() {
Result result;
User loginUser = getLoginUser();
Set<Integer> set = new HashSet();
set.add(1);
List<Integer> list = new ArrayList<>(1);
list.add(1);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS,
loginUser.getId(), projectLogger)).thenReturn(set);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
Mockito.when(projectMapper.selectBatchIds(set)).thenReturn(getList());
result = projectService.queryProjectCreatedAndAuthorizedByUser(loginUser);
List<Project> notAdminUserResult = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(notAdminUserResult));
loginUser.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS,
loginUser.getId(), projectLogger)).thenReturn(set);
Mockito.when(projectMapper.selectBatchIds(set)).thenReturn(getList());
result = projectService.queryProjectCreatedAndAuthorizedByUser(loginUser);
List<Project> projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
}
@Test
public void testQueryAllProjectList() {
Mockito.when(projectMapper.queryAllProject(0)).thenReturn(getList());
User user = new User();
user.setId(0);
Result result = projectService.queryAllProjectList(user);
logger.info(result.toString());
List<Project> projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
}
@Test
public void queryAllProjectListForDependent() {
Mockito.when(projectMapper.queryAllProjectForDependent()).thenReturn(getList());
Result result = projectService.queryAllProjectListForDependent();
logger.info(result.toString());
List<Project> projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
}
@Test
public void testQueryProjectWithAuthorizedLevel() {
Set<Integer> set = new HashSet();
set.add(1);
User loginUser = new User();
loginUser.setUserType(UserType.ADMIN_USER);
loginUser.setId(1);
List<Integer> list = new ArrayList<>(1);
list.add(1);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS,
loginUser.getId(), projectLogger)).thenReturn(set);
Mockito.when(projectMapper.listAuthorizedProjects(
loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), list))
.thenReturn(getList());
Result result = projectService.queryProjectWithAuthorizedLevel(loginUser, 2);
logger.info(result.toString());
List<Project> projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
loginUser.setId(2);
loginUser.setUserType(UserType.GENERAL_USER);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS,
loginUser.getId(), projectLogger)).thenReturn(set);
Mockito.when(projectMapper.listAuthorizedProjects(
loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), list))
.thenReturn(getList());
result = projectService.queryProjectWithAuthorizedLevel(loginUser, 3);
logger.info(result.toString());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
}
@Test
public void testQueryUnauthorizedProject() {
Set<Integer> set = new HashSet();
set.add(1);
User loginUser = new User();
loginUser.setUserType(UserType.ADMIN_USER);
loginUser.setId(1);
List<Integer> list = new ArrayList<>(1);
list.add(1);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS,
loginUser.getId(), projectLogger)).thenReturn(set);
Mockito.when(projectMapper.listAuthorizedProjects(
loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), list))
.thenReturn(getList());
Result result = projectService.queryUnauthorizedProject(loginUser, 2);
logger.info(result.toString());
List<Project> projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
loginUser.setId(2);
loginUser.setUserType(UserType.GENERAL_USER);
Mockito.when(resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS,
loginUser.getId(), projectLogger)).thenReturn(set);
Mockito.when(projectMapper.listAuthorizedProjects(
loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), list))
.thenReturn(getList());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
result = projectService.queryUnauthorizedProject(loginUser, 3);
logger.info(result.toString());
projects = (List<Project>) result.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(projects));
}
private Project getProject() {
Project project = new Project();
project.setCode(1L);
project.setId(1);
project.setName(projectName);
project.setUserId(1);
return project;
}
private Project getProject(int projectId) {
Project project = new Project();
project.setId(projectId);
project.setCode(1L);
project.setName(projectName);
project.setUserId(1);
return project;
}
private List<Project> getList() {
List<Project> list = new ArrayList<>();
list.add(getProject(1));
list.add(getProject(2));
list.add(getProject(3));
return list;
}
private List<Project> getSingleList() {
return Collections.singletonList(getProject(2));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
}
/**
* create admin user
*/
private User getLoginUser() {
User loginUser = new User();
loginUser.setUserType(UserType.GENERAL_USER);
loginUser.setUserName(userName);
loginUser.setId(1);
return loginUser;
}
/**
* Get general user
*
* @return
*/
private User getGeneralUser() {
User user = new User();
user.setUserType(UserType.GENERAL_USER);
user.setUserName("userTest0001");
user.setUserPassword("userTest0001");
return user;
}
/**
* Get user list
*
* @return
*/
private List<User> getUserList() {
List<User> userList = new ArrayList<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,697 |
[Improvement][UT] Improve the ProjectServiceTest
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Improve the ProjectServiceTest
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/12697
|
https://github.com/apache/dolphinscheduler/pull/12698
|
eb4cba8884c8e70d61d6d1aba12f718fae57a3a5
|
7c97febefbe3fc682056591e11b9cb35609cebb2
| 2022-11-04T06:07:54Z |
java
| 2023-03-01T03:37:52Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
|
userList.add(this.getGeneralUser());
return userList;
}
/**
* get project user
*/
private ProjectUser getProjectUser() {
ProjectUser projectUser = new ProjectUser();
projectUser.setProjectId(1);
projectUser.setUserId(1);
return projectUser;
}
private List<ProcessDefinition> getProcessDefinitions() {
List<ProcessDefinition> list = new ArrayList<>();
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setProjectCode(1L);
list.add(processDefinition);
return list;
}
private List<Integer> getProjectIds() {
return Collections.singletonList(1);
}
private String getDesc() {
return "projectUserMapper.deleteProjectRelation(projectId,userId)projectUserMappe"
+ ".deleteProjectRelation(projectId,userId)projectUserMappe"
+ "r.deleteProjectRelation(projectId,userId)projectUserMapper"
+ ".deleteProjectRelation(projectId,userId)projectUserMapper.deleteProjectRelation(projectId,userId)";
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
/*
* 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.apache.dolphinscheduler.plugin.task.datax;
import static org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils.decodePassword;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.RWXR_XR_X;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTask;
import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskCallBack;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.dolphinscheduler.spi.enums.Flag;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
import com.alibaba.druid.sql.ast.statement.SQLSelect;
import com.alibaba.druid.sql.ast.statement.SQLSelectItem;
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.ast.statement.SQLUnionQuery;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class DataxTask extends AbstractTask {
/**
* jvm parameters
*/
public static final String JVM_PARAM = " --jvm=\"-Xms%sG -Xmx%sG\" ";
public static final String CUSTOM_PARAM = " -D%s='%s'";
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
* python process(datax only supports version 2.7 by default)
*/
private static final String DATAX_PYTHON = "python2.7";
private static final Pattern PYTHON_PATH_PATTERN = Pattern.compile("/bin/python[\\d.]*$");
/**
* datax path
*/
private static final String DATAX_PATH = "${DATAX_HOME}/bin/datax.py";
/**
* datax channel count
*/
private static final int DATAX_CHANNEL_COUNT = 1;
/**
* datax parameters
*/
private DataxParameters dataXParameters;
/**
* shell command executor
*/
private ShellCommandExecutor shellCommandExecutor;
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
private DataxTaskExecutionContext dataxTaskExecutionContext;
/**
* constructor
*
* @param taskExecutionContext taskExecutionContext
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
public DataxTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle,
taskExecutionContext, log);
}
/**
* init DataX config
*/
@Override
public void init() {
dataXParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), DataxParameters.class);
log.info("Initialize datax task params {}", JSONUtils.toPrettyJsonString(dataXParameters));
if (dataXParameters == null || !dataXParameters.checkParameters()) {
throw new RuntimeException("datax task params is not valid");
}
dataxTaskExecutionContext =
dataXParameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper());
}
/**
* run DataX process
*
* @throws TaskException if error throws Exception
*/
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
try {
Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
String jsonFilePath = buildDataxJsonFile(paramsMap);
String shellCommandFilePath = buildShellCommandFile(jsonFilePath, paramsMap);
TaskResponse commandExecuteResult = shellCommandExecutor.run(shellCommandFilePath, taskCallBack);
setExitStatusCode(commandExecuteResult.getExitStatusCode());
setProcessId(commandExecuteResult.getProcessId());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.error("The current DataX task has been interrupted", e);
setExitStatusCode(EXIT_CODE_FAILURE);
throw new TaskException("The current DataX task has been interrupted", e);
} catch (Exception e) {
log.error("datax task error", e);
setExitStatusCode(EXIT_CODE_FAILURE);
throw new TaskException("Execute DataX task failed", e);
}
}
/**
* cancel DataX process
*
* @throws TaskException if error throws Exception
*/
@Override
public void cancel() throws TaskException {
try {
shellCommandExecutor.cancelApplication();
} catch (Exception e) {
throw new TaskException("cancel application error", e);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
/**
* build datax configuration file
*
* @return datax json file name
* @throws Exception if error throws Exception
*/
private String buildDataxJsonFile(Map<String, Property> paramsMap) throws Exception {
String fileName = String.format("%s/%s_job.json",
taskExecutionContext.getExecutePath(),
taskExecutionContext.getTaskAppId());
String json;
Path path = new File(fileName).toPath();
if (Files.exists(path)) {
return fileName;
}
if (dataXParameters.getCustomConfig() == Flag.YES.ordinal()) {
json = dataXParameters.getJson().replaceAll("\\r\\n", System.lineSeparator());
} else {
ObjectNode job = JSONUtils.createObjectNode();
job.putArray("content").addAll(buildDataxJobContentJson());
job.set("setting", buildDataxJobSettingJson());
ObjectNode root = JSONUtils.createObjectNode();
root.set("job", job);
root.set("core", buildDataxCoreJson());
json = root.toString();
}
json = ParameterUtils.convertParameterPlaceholders(json, ParamUtils.convert(paramsMap));
log.debug("datax job json : {}", json);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
FileUtils.writeStringToFile(new File(fileName), json, StandardCharsets.UTF_8);
return fileName;
}
/**
* build datax job config
*
* @return collection of datax job config JSONObject
*/
private List<ObjectNode> buildDataxJobContentJson() {
BaseConnectionParam dataSourceCfg = (BaseConnectionParam) DataSourceUtils.buildConnectionParams(
dataxTaskExecutionContext.getSourcetype(),
dataxTaskExecutionContext.getSourceConnectionParams());
BaseConnectionParam dataTargetCfg = (BaseConnectionParam) DataSourceUtils.buildConnectionParams(
dataxTaskExecutionContext.getTargetType(),
dataxTaskExecutionContext.getTargetConnectionParams());
List<ObjectNode> readerConnArr = new ArrayList<>();
ObjectNode readerConn = JSONUtils.createObjectNode();
ArrayNode sqlArr = readerConn.putArray("querySql");
for (String sql : new String[]{dataXParameters.getSql()}) {
sqlArr.add(sql);
}
ArrayNode urlArr = readerConn.putArray("jdbcUrl");
urlArr.add(DataSourceUtils.getJdbcUrl(DbType.valueOf(dataXParameters.getDsType()), dataSourceCfg));
readerConnArr.add(readerConn);
ObjectNode readerParam = JSONUtils.createObjectNode();
readerParam.put("username", dataSourceCfg.getUser());
readerParam.put("password", decodePassword(dataSourceCfg.getPassword()));
readerParam.putArray("connection").addAll(readerConnArr);
ObjectNode reader = JSONUtils.createObjectNode();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
reader.put("name", DataxUtils.getReaderPluginName(dataxTaskExecutionContext.getSourcetype()));
reader.set("parameter", readerParam);
List<ObjectNode> writerConnArr = new ArrayList<>();
ObjectNode writerConn = JSONUtils.createObjectNode();
ArrayNode tableArr = writerConn.putArray("table");
tableArr.add(dataXParameters.getTargetTable());
writerConn.put("jdbcUrl",
DataSourceUtils.getJdbcUrl(DbType.valueOf(dataXParameters.getDtType()), dataTargetCfg));
writerConnArr.add(writerConn);
ObjectNode writerParam = JSONUtils.createObjectNode();
writerParam.put("username", dataTargetCfg.getUser());
writerParam.put("password", decodePassword(dataTargetCfg.getPassword()));
String[] columns = parsingSqlColumnNames(dataxTaskExecutionContext.getSourcetype(),
dataxTaskExecutionContext.getTargetType(),
dataSourceCfg, dataXParameters.getSql());
ArrayNode columnArr = writerParam.putArray("column");
for (String column : columns) {
columnArr.add(column);
}
writerParam.putArray("connection").addAll(writerConnArr);
if (CollectionUtils.isNotEmpty(dataXParameters.getPreStatements())) {
ArrayNode preSqlArr = writerParam.putArray("preSql");
for (String preSql : dataXParameters.getPreStatements()) {
preSqlArr.add(preSql);
}
}
if (CollectionUtils.isNotEmpty(dataXParameters.getPostStatements())) {
ArrayNode postSqlArr = writerParam.putArray("postSql");
for (String postSql : dataXParameters.getPostStatements()) {
postSqlArr.add(postSql);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
}
}
ObjectNode writer = JSONUtils.createObjectNode();
writer.put("name", DataxUtils.getWriterPluginName(dataxTaskExecutionContext.getTargetType()));
writer.set("parameter", writerParam);
List<ObjectNode> contentList = new ArrayList<>();
ObjectNode content = JSONUtils.createObjectNode();
content.set("reader", reader);
content.set("writer", writer);
contentList.add(content);
return contentList;
}
/**
* build datax setting config
*
* @return datax setting config JSONObject
*/
private ObjectNode buildDataxJobSettingJson() {
ObjectNode speed = JSONUtils.createObjectNode();
speed.put("channel", DATAX_CHANNEL_COUNT);
if (dataXParameters.getJobSpeedByte() > 0) {
speed.put("byte", dataXParameters.getJobSpeedByte());
}
if (dataXParameters.getJobSpeedRecord() > 0) {
speed.put("record", dataXParameters.getJobSpeedRecord());
}
ObjectNode errorLimit = JSONUtils.createObjectNode();
errorLimit.put("record", 0);
errorLimit.put("percentage", 0);
ObjectNode setting = JSONUtils.createObjectNode();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
setting.set("speed", speed);
setting.set("errorLimit", errorLimit);
return setting;
}
private ObjectNode buildDataxCoreJson() {
ObjectNode speed = JSONUtils.createObjectNode();
speed.put("channel", DATAX_CHANNEL_COUNT);
if (dataXParameters.getJobSpeedByte() > 0) {
speed.put("byte", dataXParameters.getJobSpeedByte());
}
if (dataXParameters.getJobSpeedRecord() > 0) {
speed.put("record", dataXParameters.getJobSpeedRecord());
}
ObjectNode channel = JSONUtils.createObjectNode();
channel.set("speed", speed);
ObjectNode transport = JSONUtils.createObjectNode();
transport.set("channel", channel);
ObjectNode core = JSONUtils.createObjectNode();
core.set("transport", transport);
return core;
}
/**
* create command
*
* @return shell command file name
* @throws Exception if error throws Exception
*/
private String buildShellCommandFile(String jobConfigFilePath, Map<String, Property> paramsMap) throws Exception {
String fileName = String.format("%s/%s_node.%s",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
taskExecutionContext.getExecutePath(),
taskExecutionContext.getTaskAppId(),
SystemUtils.IS_OS_WINDOWS ? "bat" : "sh");
Path path = new File(fileName).toPath();
if (Files.exists(path)) {
return fileName;
}
String sbr = getPythonCommand() +
" " +
DATAX_PATH +
" " +
loadJvmEnv(dataXParameters) +
addCustomParameters(paramsMap) +
" " +
jobConfigFilePath;
String dataxCommand = ParameterUtils.convertParameterPlaceholders(sbr, ParamUtils.convert(paramsMap));
log.debug("raw script : {}", dataxCommand);
Set<PosixFilePermission> perms = PosixFilePermissions.fromString(RWXR_XR_X);
FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms);
if (SystemUtils.IS_OS_WINDOWS) {
Files.createFile(path);
} else {
Files.createFile(path, attr);
}
Files.write(path, dataxCommand.getBytes(), StandardOpenOption.APPEND);
return fileName;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
private StringBuilder addCustomParameters(Map<String, Property> paramsMap) {
if (paramsMap == null || paramsMap.size() == 0) {
return new StringBuilder();
}
StringBuilder customParameters = new StringBuilder("-p \"");
for (Map.Entry<String, Property> entry : paramsMap.entrySet()) {
customParameters.append(String.format(CUSTOM_PARAM, entry.getKey(), entry.getValue().getValue()));
}
customParameters.replace(4, 5, "");
customParameters.append("\"");
return customParameters;
}
public String getPythonCommand() {
String pythonHome = System.getenv("PYTHON_HOME");
return getPythonCommand(pythonHome);
}
public String getPythonCommand(String pythonHome) {
if (StringUtils.isEmpty(pythonHome)) {
return DATAX_PYTHON;
}
String pythonBinPath = "/bin/" + DATAX_PYTHON;
Matcher matcher = PYTHON_PATH_PATTERN.matcher(pythonHome);
if (matcher.find()) {
return matcher.replaceAll(pythonBinPath);
}
return Paths.get(pythonHome, pythonBinPath).toString();
}
public String loadJvmEnv(DataxParameters dataXParameters) {
int xms = Math.max(dataXParameters.getXms(), 1);
int xmx = Math.max(dataXParameters.getXmx(), 1);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
return String.format(JVM_PARAM, xms, xmx);
}
/**
* parsing synchronized column names in SQL statements
*
* @param sourceType the database type of the data source
* @param targetType the database type of the data target
* @param dataSourceCfg the database connection parameters of the data source
* @param sql sql for data synchronization
* @return Keyword converted column names
*/
private String[] parsingSqlColumnNames(DbType sourceType, DbType targetType, BaseConnectionParam dataSourceCfg,
String sql) {
String[] columnNames = tryGrammaticalAnalysisSqlColumnNames(sourceType, sql);
if (columnNames == null || columnNames.length == 0) {
log.info("try to execute sql analysis query column name");
columnNames = tryExecuteSqlResolveColumnNames(sourceType, dataSourceCfg, sql);
}
notNull(columnNames, String.format("parsing sql columns failed : %s", sql));
return DataxUtils.convertKeywordsColumns(targetType, columnNames);
}
/**
* try grammatical parsing column
*
* @param dbType database type
* @param sql sql for data synchronization
* @return column name array
* @throws RuntimeException if error throws RuntimeException
*/
private String[] tryGrammaticalAnalysisSqlColumnNames(DbType dbType, String sql) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
String[] columnNames;
try {
SQLStatementParser parser = DataxUtils.getSqlStatementParser(dbType, sql);
if (parser == null) {
log.warn("database driver [{}] is not support grammatical analysis sql", dbType);
return new String[0];
}
SQLStatement sqlStatement = parser.parseStatement();
SQLSelectStatement sqlSelectStatement = (SQLSelectStatement) sqlStatement;
SQLSelect sqlSelect = sqlSelectStatement.getSelect();
List<SQLSelectItem> selectItemList = null;
if (sqlSelect.getQuery() instanceof SQLSelectQueryBlock) {
SQLSelectQueryBlock block = (SQLSelectQueryBlock) sqlSelect.getQuery();
selectItemList = block.getSelectList();
} else if (sqlSelect.getQuery() instanceof SQLUnionQuery) {
SQLUnionQuery unionQuery = (SQLUnionQuery) sqlSelect.getQuery();
SQLSelectQueryBlock block = (SQLSelectQueryBlock) unionQuery.getRight();
selectItemList = block.getSelectList();
}
notNull(selectItemList,
String.format("select query type [%s] is not support", sqlSelect.getQuery().toString()));
columnNames = new String[selectItemList.size()];
for (int i = 0; i < selectItemList.size(); i++) {
SQLSelectItem item = selectItemList.get(i);
String columnName = null;
if (item.getAlias() != null) {
columnName = item.getAlias();
} else if (item.getExpr() != null) {
if (item.getExpr() instanceof SQLPropertyExpr) {
SQLPropertyExpr expr = (SQLPropertyExpr) item.getExpr();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
columnName = expr.getName();
} else if (item.getExpr() instanceof SQLIdentifierExpr) {
SQLIdentifierExpr expr = (SQLIdentifierExpr) item.getExpr();
columnName = expr.getName();
}
} else {
throw new RuntimeException(
String.format("grammatical analysis sql column [ %s ] failed", item));
}
if (columnName == null) {
throw new RuntimeException(
String.format("grammatical analysis sql column [ %s ] failed", item));
}
columnNames[i] = columnName;
}
} catch (Exception e) {
log.warn(e.getMessage(), e);
return new String[0];
}
return columnNames;
}
/**
* try to execute sql to resolve column names
*
* @param baseDataSource the database connection parameters
* @param sql sql for data synchronization
* @return column name array
*/
public String[] tryExecuteSqlResolveColumnNames(DbType sourceType, BaseConnectionParam baseDataSource, String sql) {
String[] columnNames;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,665 |
[Improvement][Datax] if sql include ``` * ``` will print error information in log
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description

### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13665
|
https://github.com/apache/dolphinscheduler/pull/13680
|
35d8e8ac172fac7b992b8d60d2a875aefccaa652
|
6218f818c036b75a23c0df1cc8f0ce464d212f09
| 2023-03-03T08:18:08Z |
java
| 2023-03-07T03:16:53Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
|
sql = String.format("SELECT t.* FROM ( %s ) t WHERE 0 = 1", sql);
sql = sql.replace(";", "");
try (
Connection connection =
DataSourceClientProvider.getInstance().getConnection(sourceType, baseDataSource);
PreparedStatement stmt = connection.prepareStatement(sql);
ResultSet resultSet = stmt.executeQuery()) {
ResultSetMetaData md = resultSet.getMetaData();
int num = md.getColumnCount();
columnNames = new String[num];
for (int i = 1; i <= num; i++) {
columnNames[i - 1] = md.getColumnName(i).replace("t.", "");
}
} catch (SQLException | ExecutionException e) {
log.error(e.getMessage(), e);
return null;
}
return columnNames;
}
@Override
public AbstractParameters getParameters() {
return dataXParameters;
}
private void notNull(Object obj, String message) {
if (obj == null) {
throw new RuntimeException(message);
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
/*
* 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.apache.dolphinscheduler.plugin.alert.email;
import static java.util.Objects.requireNonNull;
import org.apache.dolphinscheduler.alert.api.AlertConstants;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.alert.api.ShowType;
import org.apache.dolphinscheduler.plugin.alert.email.exception.AlertEmailException;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
import org.apache.dolphinscheduler.plugin.alert.email.template.AlertTemplate;
import org.apache.dolphinscheduler.plugin.alert.email.template.DefaultHTMLTemplate;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
import javax.activation.CommandMap;
import javax.activation.MailcapCommandMap;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import lombok.extern.slf4j.Slf4j;
import com.sun.mail.smtp.SMTPProvider;
@Slf4j
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
public final class MailSender {
private final List<String> receivers;
private final List<String> receiverCcs;
private final String mailProtocol = "SMTP";
private final String mailSmtpHost;
private final String mailSmtpPort;
private final String mailSenderEmail;
private final String enableSmtpAuth;
private final String mailUser;
private final String mailPasswd;
private final String mailUseStartTLS;
private final String mailUseSSL;
private final String sslTrust;
private final String showType;
private final AlertTemplate alertTemplate;
private final String mustNotNull = " must not be null";
private String xlsFilePath;
public MailSender(Map<String, String> config) {
String receiversConfig = config.get(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS);
if (receiversConfig == null || "".equals(receiversConfig)) {
throw new AlertEmailException(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS + mustNotNull);
}
receivers = Arrays.asList(receiversConfig.split(","));
String receiverCcsConfig = config.get(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS);
receiverCcs = new ArrayList<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
if (receiverCcsConfig != null && !"".equals(receiverCcsConfig)) {
receiverCcs.addAll(Arrays.asList(receiverCcsConfig.split(",")));
}
mailSmtpHost = config.get(MailParamsConstants.NAME_MAIL_SMTP_HOST);
requireNonNull(mailSmtpHost, MailParamsConstants.NAME_MAIL_SMTP_HOST + mustNotNull);
mailSmtpPort = config.get(MailParamsConstants.NAME_MAIL_SMTP_PORT);
requireNonNull(mailSmtpPort, MailParamsConstants.NAME_MAIL_SMTP_PORT + mustNotNull);
mailSenderEmail = config.get(MailParamsConstants.NAME_MAIL_SENDER);
requireNonNull(mailSenderEmail, MailParamsConstants.NAME_MAIL_SENDER + mustNotNull);
enableSmtpAuth = config.get(MailParamsConstants.NAME_MAIL_SMTP_AUTH);
mailUser = config.get(MailParamsConstants.NAME_MAIL_USER);
requireNonNull(mailUser, MailParamsConstants.NAME_MAIL_USER + mustNotNull);
mailPasswd = config.get(MailParamsConstants.NAME_MAIL_PASSWD);
requireNonNull(mailPasswd, MailParamsConstants.NAME_MAIL_PASSWD + mustNotNull);
mailUseStartTLS = config.get(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE);
requireNonNull(mailUseStartTLS, MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE + mustNotNull);
mailUseSSL = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE);
requireNonNull(mailUseSSL, MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE + mustNotNull);
sslTrust = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST);
requireNonNull(sslTrust, MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST + mustNotNull);
showType = config.get(AlertConstants.NAME_SHOW_TYPE);
requireNonNull(showType, AlertConstants.NAME_SHOW_TYPE + mustNotNull);
xlsFilePath = config.get(EmailConstants.XLS_FILE_PATH);
if (StringUtils.isBlank(xlsFilePath)) {
xlsFilePath = "/tmp/xls";
}
alertTemplate = new DefaultHTMLTemplate();
}
/**
* send mail to receivers
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
*
* @param title title
* @param content content
*/
public AlertResult sendMails(String title, String content) {
return sendMails(this.receivers, this.receiverCcs, title, content);
}
/**
* send mail
*
* @param receivers receivers
* @param receiverCcs receiverCcs
* @param title title
* @param content content
*/
public AlertResult sendMails(List<String> receivers, List<String> receiverCcs, String title, String content) {
AlertResult alertResult = new AlertResult();
alertResult.setStatus("false");
if (CollectionUtils.isEmpty(receivers) && CollectionUtils.isEmpty(receiverCcs)) {
return alertResult;
}
receivers.removeIf(StringUtils::isEmpty);
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
if (showType.equals(ShowType.TABLE.getDescp()) || showType.equals(ShowType.TEXT.getDescp())) {
HtmlEmail email = new HtmlEmail();
try {
Session session = getSession();
email.setMailSession(session);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
email.setFrom(mailSenderEmail);
email.setCharset(EmailConstants.UTF_8);
if (CollectionUtils.isNotEmpty(receivers)) {
for (String receiver : receivers) {
email.addTo(receiver);
}
}
if (CollectionUtils.isNotEmpty(receiverCcs)) {
for (String receiverCc : receiverCcs) {
email.addCc(receiverCc);
}
}
return getStringObjectMap(title, content, alertResult, email);
} catch (Exception e) {
handleException(alertResult, e);
}
} else if (showType.equals(ShowType.ATTACHMENT.getDescp())
|| showType.equals(ShowType.TABLE_ATTACHMENT.getDescp())) {
try {
String partContent = (showType.equals(ShowType.ATTACHMENT.getDescp())
? "Please see the attachment " + title + EmailConstants.EXCEL_SUFFIX_XLSX
: htmlTable(content, false));
attachment(title, content, partContent);
alertResult.setStatus("true");
return alertResult;
} catch (Exception e) {
handleException(alertResult, e);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
return alertResult;
}
}
return alertResult;
}
/**
* html table content
*
* @param content the content
* @param showAll if show the whole content
* @return the html table form
*/
private String htmlTable(String content, boolean showAll) {
return alertTemplate.getMessageFromTemplate(content, ShowType.TABLE, showAll);
}
/**
* html table content
*
* @param content the content
* @return the html table form
*/
private String htmlTable(String content) {
return htmlTable(content, true);
}
/**
* html text content
*
* @param content the content
* @return text in html form
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
private String htmlText(String content) {
return alertTemplate.getMessageFromTemplate(content, ShowType.TEXT);
}
/**
* send mail as Excel attachment
*/
private void attachment(String title, String content, String partContent) throws Exception {
MimeMessage msg = getMimeMessage();
attachContent(title, content, partContent, msg);
}
/**
* get MimeMessage
*/
private MimeMessage getMimeMessage() throws MessagingException {
Session session = getSession();
session.setDebug(false);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(mailSenderEmail));
for (String receiver : receivers) {
msg.addRecipients(Message.RecipientType.TO, InternetAddress.parse(receiver));
}
return msg;
}
/**
* get session
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
*
* @return the new Session
*/
private Session getSession() {
MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
CommandMap.setDefaultCommandMap(mc);
Properties props = new Properties();
props.setProperty(MailParamsConstants.MAIL_SMTP_HOST, mailSmtpHost);
props.setProperty(MailParamsConstants.MAIL_SMTP_PORT, mailSmtpPort);
props.setProperty(MailParamsConstants.MAIL_SMTP_AUTH, enableSmtpAuth);
props.setProperty(EmailConstants.MAIL_TRANSPORT_PROTOCOL, mailProtocol);
props.setProperty(MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE, mailUseStartTLS);
props.setProperty(MailParamsConstants.MAIL_SMTP_SSL_ENABLE, mailUseSSL);
props.setProperty(MailParamsConstants.MAIL_SMTP_SSL_TRUST, sslTrust);
Authenticator auth = new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(mailUser, mailPasswd);
}
};
Session session = Session.getInstance(props, auth);
session.addProvider(new SMTPProvider());
return session;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
}
/**
* attach content
*/
private void attachContent(String title, String content, String partContent,
MimeMessage msg) throws MessagingException, IOException {
/*
* set receiverCc
*/
if (CollectionUtils.isNotEmpty(receiverCcs)) {
for (String receiverCc : receiverCcs) {
msg.addRecipients(Message.RecipientType.CC, InternetAddress.parse(receiverCc));
}
}
msg.setSubject(title);
MimeMultipart partList = new MimeMultipart();
MimeBodyPart part1 = new MimeBodyPart();
part1.setContent(partContent, EmailConstants.TEXT_HTML_CHARSET_UTF_8);
MimeBodyPart part2 = new MimeBodyPart();
String randomFilename = title + UUID.randomUUID();
File file =
new File(xlsFilePath + EmailConstants.SINGLE_SLASH + randomFilename + EmailConstants.EXCEL_SUFFIX_XLSX);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
ExcelUtils.genExcelFile(content, randomFilename, xlsFilePath);
part2.attachFile(file);
part2.setFileName(MimeUtility.encodeText(title + EmailConstants.EXCEL_SUFFIX_XLSX, EmailConstants.UTF_8, "B"));
partList.addBodyPart(part1);
partList.addBodyPart(part2);
msg.setContent(partList);
Transport.send(msg);
deleteFile(file);
}
/**
* the string object map
*/
private AlertResult getStringObjectMap(String title, String content, AlertResult alertResult,
HtmlEmail email) throws EmailException {
/*
* the subject of the message to be sent
*/
email.setSubject(title);
/*
* to send information, you can use HTML tags in mail content because of the use of HtmlEmail
*/
if (showType.equals(ShowType.TABLE.getDescp())) {
email.setMsg(htmlTable(content));
} else if (showType.equals(ShowType.TEXT.getDescp())) {
email.setMsg(htmlText(content));
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java
|
email.setDebug(true);
email.send();
alertResult.setStatus("true");
return alertResult;
}
/**
* file delete
*
* @param file the file to delete
*/
public void deleteFile(File file) {
if (file.exists()) {
if (file.delete()) {
log.info("delete success: {}", file.getAbsolutePath());
} else {
log.info("delete fail: {}", file.getAbsolutePath());
}
} else {
log.info("file not exists: {}", file.getAbsolutePath());
}
}
/**
* handle exception
*/
private void handleException(AlertResult alertResult, Exception e) {
log.error("Send email to {} failed", receivers, e);
alertResult.setMessage("Send email to {" + String.join(",", receivers) + "} failed," + e.toString());
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java
|
/*
* 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.apache.dolphinscheduler.plugin.alert.email;
import org.apache.dolphinscheduler.alert.api.AlertConstants;
import org.apache.dolphinscheduler.alert.api.ShowType;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.alert.email.template.AlertTemplate;
import org.apache.dolphinscheduler.plugin.alert.email.template.DefaultHTMLTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java
|
import java.util.Map;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Disabled("The test case makes no sense")
public class MailUtilsTest {
private static final Logger logger = LoggerFactory.getLogger(MailUtilsTest.class);
static MailSender mailSender;
private static Map<String, String> emailConfig = new HashMap<>();
private static AlertTemplate alertTemplate;
@BeforeAll
public static void initEmailConfig() {
emailConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
emailConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
emailConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
emailConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_AUTH, "true");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
emailConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "[email protected]");
emailConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "[email protected]");
emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TEXT.getDescp());
alertTemplate = new DefaultHTMLTemplate();
mailSender = new MailSender(emailConfig);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java
|
@Test
public void testSendMails() {
String content = "[\"id:69\","
+ "\"name:UserBehavior-0--1193959466\","
+ "\"Job name: Start workflow\","
+ "\"State: SUCCESS\","
+ "\"Recovery:NO\","
+ "\"Run time: 1\","
+ "\"Start time: 2018-08-06 10:31:34.0\","
+ "\"End time: 2018-08-06 10:31:49.0\","
+ "\"Host: 192.168.xx.xx\","
+ "\"Notify group :4\"]";
mailSender.sendMails(
"Mysql Exception",
content);
}
public String list2String() {
LinkedHashMap<String, Object> map1 = new LinkedHashMap<>();
map1.put("mysql service name", "mysql200");
map1.put("mysql address", "192.168.xx.xx");
map1.put("port", "3306");
map1.put("no index of number", "80");
map1.put("database client connections", "190");
LinkedHashMap<String, Object> map2 = new LinkedHashMap<>();
map2.put("mysql service name", "mysql210");
map2.put("mysql address", "192.168.xx.xx");
map2.put("port", "3306");
map2.put("no index of number", "10");
map2.put("database client connections", "90");
List<LinkedHashMap<String, Object>> maps = new ArrayList<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,455 |
[Feature][UI] hidden unnecessary mail.smtp.auth fileds, when user choose disable mail.smtp.auth
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
as the comment [https://github.com/apache/dolphinscheduler/pull/10721#issuecomment-1197870428](url) said,
it's more friendly for user to hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
<img width="535" alt="Screen Shot 2022-08-12 at 16 53 59" src="https://user-images.githubusercontent.com/38579068/184321633-5e8e073e-34c8-43e1-aaba-03fef2c47a42.png">
### Use case
hidden the field for mail.smtp.auth(fields in the red rectangle), when user choose disable mail.smtp.auth
### Related issues
https://github.com/apache/dolphinscheduler/issues/10698
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11455
|
https://github.com/apache/dolphinscheduler/pull/13761
|
1075be6e62a4aae65682f2b4db0e38b16006e1af
|
69e744961b489c9553e656b8d1f6247b46884e05
| 2022-08-12T09:03:23Z |
java
| 2023-03-21T05:59:01Z |
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java
|
maps.add(0, map1);
maps.add(1, map2);
String mapjson = JSONUtils.toJsonString(maps);
logger.info(mapjson);
return mapjson;
}
@Test
public void testSendTableMail() {
String title = "Mysql Exception";
String content = list2String();
emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TABLE.getDescp());
mailSender = new MailSender(emailConfig);
mailSender.sendMails(title, content);
}
@Test
public void testAttachmentFile() throws Exception {
String content = list2String();
emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.ATTACHMENT.getDescp());
mailSender = new MailSender(emailConfig);
mailSender.sendMails("gaojing", content);
}
@Test
public void testTableAttachmentFile() throws Exception {
String content = list2String();
emailConfig.put(AlertConstants.NAME_SHOW_TYPE, ShowType.TABLE_ATTACHMENT.getDescp());
mailSender = new MailSender(emailConfig);
mailSender.sendMails("gaojing", content);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
/*
* 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.apache.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.common.constants.Constants.ALIAS;
import static org.apache.dolphinscheduler.common.constants.Constants.CONTENT;
import static org.apache.dolphinscheduler.common.constants.Constants.FOLDER_SEPARATOR;
import static org.apache.dolphinscheduler.common.constants.Constants.FORMAT_SS;
import static org.apache.dolphinscheduler.common.constants.Constants.FORMAT_S_S;
import static org.apache.dolphinscheduler.common.constants.Constants.JAR;
import static org.apache.dolphinscheduler.common.constants.Constants.PERIOD;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
import org.apache.dolphinscheduler.api.dto.resources.DeleteDataTransferResponse;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter;
import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor;
import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.RegexUtils;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ProgramType;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.ResourcesTask;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceMapper;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
import org.apache.dolphinscheduler.dao.mapper.ResourceTaskMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.plugin.storage.api.StorageEntity;
import org.apache.dolphinscheduler.plugin.storage.api.StorageOperate;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.base.Joiner;
import com.google.common.io.Files;
/**
* resources service impl
*/
@Service
@Slf4j
public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesService {
@Autowired
private ResourceMapper resourcesMapper;
@Autowired
private ResourceTaskMapper resourceTaskMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private UdfFuncMapper udfFunctionMapper;
@Autowired
private ProcessService processService;
@Autowired
private ProcessDefinitionService processDefinitionService;
@Autowired
private TenantMapper tenantMapper;
@Autowired
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
private UserMapper userMapper;
@Autowired
private ResourceUserMapper resourceUserMapper;
@Autowired
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired(required = false)
private StorageOperate storageOperate;
/**
* create directory
*
* @param loginUser login user
* @param name alias
* @param description description
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create directory result
*/
@Override
@Transactional
public Result<Object> createDirectory(User loginUser,
String name,
String description,
ResourceType type,
int pid,
String currentDir) {
Result<Object> result = new Result<>();
result = checkResourceUploadStartupState();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
if (FileUtils.directoryTraversal(name)) {
log.warn("Parameter name is invalid, name:{}.", RegexUtils.escapeNRT(name));
putMsg(result, Status.VERIFY_PARAMETER_NAME_FAILED);
return result;
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
log.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return result;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
log.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return result;
}
String tenantCode = tenant.getTenantCode();
if (!isUserTenantValid(isAdmin(loginUser), tenantCode, "")) {
log.error("current user does not have permission");
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
if (checkDescriptionLength(description)) {
log.warn("Parameter description is too long.");
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
}
String userResRootPath = ResourceType.UDF.equals(type) ? storageOperate.getUdfDir(tenantCode)
: storageOperate.getResDir(tenantCode);
String fullName = !currentDir.contains(userResRootPath) ? userResRootPath + name : currentDir + name;
try {
if (checkResourceExists(fullName)) {
log.error("resource directory {} has exist, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
} catch (Exception e) {
log.warn("Resource exists, can not create again, fullName:{}.", fullName, e);
throw new ServiceException("resource already exists, can't recreate");
}
createDirectory(loginUser, fullName, type, result);
return result;
}
private String getFullName(String currentDir, String name) {
return currentDir.equals(FOLDER_SEPARATOR) ? String.format(FORMAT_SS, currentDir, name)
: String.format(FORMAT_S_S, currentDir, name);
}
/**
* create resource
*
* @param loginUser login user
* @param name alias
* @param desc description
* @param type type
* @param file file
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
* @param currentDir current directory
* @return create result code
*/
@Override
@Transactional
public Result<Object> createResource(User loginUser,
String name,
String desc,
ResourceType type,
MultipartFile file,
String currentDir) {
Result<Object> result = new Result<>();
result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
log.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return result;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
log.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return result;
}
String tenantCode = tenant.getTenantCode();
if (!isUserTenantValid(isAdmin(loginUser), tenantCode, "")) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
log.error("current user does not have permission");
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
result = verifyFile(name, type, file);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
String userResRootPath = ResourceType.UDF.equals(type) ? storageOperate.getUdfDir(tenantCode)
: storageOperate.getResDir(tenantCode);
String currDirNFileName = !currentDir.contains(userResRootPath) ? userResRootPath + name : currentDir + name;
try {
if (checkResourceExists(currDirNFileName)) {
log.error("resource {} has exist, can't recreate", RegexUtils.escapeNRT(name));
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
} catch (Exception e) {
throw new ServiceException("resource already exists, can't recreate");
}
if (currDirNFileName.length() > Constants.RESOURCE_FULL_NAME_MAX_LENGTH) {
log.error(
"Resource file's name is longer than max full name length, fullName:{}, " +
"fullNameSize:{}, maxFullNameSize:{}",
RegexUtils.escapeNRT(name), currDirNFileName.length(), Constants.RESOURCE_FULL_NAME_MAX_LENGTH);
putMsg(result, Status.RESOURCE_FULL_NAME_TOO_LONG_ERROR);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
if (!upload(loginUser, currDirNFileName, file, type)) {
log.error("upload resource: {} file: {} failed.", RegexUtils.escapeNRT(name),
RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
throw new ServiceException(
String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
} else
log.info("Upload resource file complete, resourceName:{}, fileName:{}.",
RegexUtils.escapeNRT(name), RegexUtils.escapeNRT(file.getOriginalFilename()));
return result;
}
/**
* update the folder's size of the resource
*
* @param resource the current resource
* @param size size
*/
private void updateParentResourceSize(Resource resource, long size) {
if (resource.getSize() > 0) {
String[] splits = resource.getFullName().split("/");
for (int i = 1; i < splits.length; i++) {
String parentFullName = Joiner.on("/").join(Arrays.copyOfRange(splits, 0, i));
if (StringUtils.isNotBlank(parentFullName)) {
List<Resource> resources =
resourcesMapper.queryResource(parentFullName, resource.getType().ordinal());
if (CollectionUtils.isNotEmpty(resources)) {
Resource parentResource = resources.get(0);
if (parentResource.getSize() + size >= 0) {
parentResource.setSize(parentResource.getSize() + size);
} else {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
parentResource.setSize(0L);
}
resourcesMapper.updateById(parentResource);
log.info("Resource size update complete, resourceFullName:{}, newSize:{}.",
parentResource.getFullName(), parentResource.getSize());
}
}
}
}
}
/**
* check resource is exists
*
* @param fullName fullName
* @return true if resource exists
*/
private boolean checkResourceExists(String fullName) {
Boolean existResource = false;
try {
existResource = storageOperate.exists(fullName);
} catch (IOException e) {
log.error("error occurred when checking resource: " + fullName, e);
}
return Boolean.TRUE.equals(existResource);
}
/**
* update resource
*
* @param loginUser login user
* @param resourceFullName resource full name
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
* @param resTenantCode tenantCode in the request field "resTenantCode" for tenant code owning the resource,
* can be different from the login user in the case of logging in as admin users.
* @param name name
* @param desc description
* @param type resource type
* @param file resource file
* @return update result code
*/
@Override
@Transactional
public Result<Object> updateResource(User loginUser,
String resourceFullName,
String resTenantCode,
String name,
String desc,
ResourceType type,
MultipartFile file) {
Result<Object> result = new Result<>();
result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
log.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return result;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
log.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return result;
}
String tenantCode = tenant.getTenantCode();
if (!isUserTenantValid(isAdmin(loginUser), tenantCode, resTenantCode)) {
log.error("current user does not have permission");
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
String defaultPath = storageOperate.getResDir(tenantCode);
StorageEntity resource;
try {
resource = storageOperate.getFileStatus(resourceFullName, defaultPath, resTenantCode, type);
} catch (Exception e) {
log.error("Get file status fail, resource path: {}", resourceFullName, e);
putMsg(result, Status.RESOURCE_NOT_EXIST);
throw new ServiceException((String.format("Get file status fail, resource path: %s", resourceFullName)));
}
if (!PropertyUtils.getResUploadStartupState()) {
log.error("Storage does not start up, resource upload startup state: {}.",
PropertyUtils.getResUploadStartupState());
putMsg(result, Status.STORAGE_NOT_STARTUP);
return result;
}
if (resource.isDirectory() && storageOperate.returnStorageType().equals(ResUploadType.S3)
&& !resource.getFileName().equals(name)) {
log.warn("Directory in S3 storage can not be renamed.");
putMsg(result, Status.S3_CANNOT_RENAME);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
return result;
}
if (file == null && name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) {
log.info("Resource does not need to be updated due to no change, resource full name:{}.",
resourceFullName);
putMsg(result, Status.SUCCESS);
return result;
}
String originFullName = resource.getFullName();
String originResourceName = resource.getAlias();
originFullName = originFullName.endsWith("/") ? StringUtils.chop(originFullName) : originFullName;
name = name.endsWith("/") ? StringUtils.chop(name) : name;
String fullName = String.format(FORMAT_SS,
originFullName.substring(0, originFullName.lastIndexOf(FOLDER_SEPARATOR) + 1), name);
if (!originResourceName.equals(name)) {
try {
if (checkResourceExists(fullName)) {
log.error("resource {} already exists, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
} catch (Exception e) {
throw new ServiceException(String.format("error occurs while querying resource: %s", fullName));
}
}
result = verifyFile(name, type, file);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
return result;
}
Date now = new Date();
long originFileSize = resource.getSize();
resource.setAlias(name);
resource.setFileName(name);
resource.setFullName(fullName);
resource.setDescription(desc);
resource.setUpdateTime(now);
if (file != null) {
resource.setSize(file.getSize());
}
if (originResourceName.equals(name) && file == null) {
return result;
}
List<ResourcesTask> existResourcesList;
if (resource.isDirectory()) {
existResourcesList = resourceTaskMapper.selectSubfoldersFullNames(originFullName + FOLDER_SEPARATOR);
} else {
existResourcesList = resourceTaskMapper.selectByMap(
Collections.singletonMap("full_name", originFullName));
}
if (existResourcesList.size() > 0 && !fullName.equals(originFullName)) {
for (ResourcesTask existResource : existResourcesList) {
int taskId = existResource.getTaskId();
if (processService.isTaskOnline(taskDefinitionMapper.selectById(taskId).getCode())) {
log.error("can't be updated,because it is used of process definition that's online");
log.error("resource task relation id:{} is used of task code {}", existResource.getId(),
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
taskDefinitionMapper.selectById(taskId).getCode());
putMsg(result, Status.RESOURCE_IS_USED);
return result;
}
}
for (ResourcesTask existResource : existResourcesList) {
int taskId = existResource.getTaskId();
long taskCode = taskDefinitionMapper.selectById(taskId).getCode();
List<ProcessTaskRelation> processTaskRelation = processTaskRelationMapper.selectByMap(
Collections.singletonMap("post_task_code", taskCode));
if (processTaskRelation.size() > 0) {
long processDefinitionCode = processTaskRelation.get(0).getProcessDefinitionCode();
int processDefinitionVersion = processTaskRelation.get(0).getProcessDefinitionVersion();
List<ProcessTaskRelation> taskRelationList = processTaskRelationMapper.queryByProcessCode(
processTaskRelation.get(0).getProjectCode(),
processDefinitionCode);
List<TaskDefinition> taskDefinitionLogList = new ArrayList<>();
if (taskRelationList.size() > 0) {
ProcessDefinitionLog processDefinition =
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(
processDefinitionCode, processDefinitionVersion);
for (ProcessTaskRelation taskRelation : taskRelationList) {
long taskCodeInProcess = taskRelation.getPostTaskCode();
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCodeInProcess);
if (taskCodeInProcess == taskCode) {
taskDefinition.setTaskParams(RemoveResourceFromResourceList(originFullName,
taskDefinition.getTaskParams(),
resource.isDirectory()));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
taskDefinition.setTaskParams(AddResourceToResourceList(originFullName,
fullName,
existResource.getFullName(),
taskDefinition.getTaskParams(),
resource.isDirectory()));
}
taskDefinitionLogList.add(taskDefinition);
}
if (processDefinition != null) {
processDefinitionService.updateProcessDefinition(loginUser,
processDefinition.getProjectCode(),
processDefinition.getName(),
processDefinition.getCode(),
processDefinition.getDescription(),
processDefinition.getGlobalParams(),
processDefinition.getLocations(),
processDefinition.getTimeout(),
tenantCode,
JSONUtils.toJsonString(taskRelationList.toArray()),
JSONUtils.toJsonString(taskDefinitionLogList.toArray()),
"",
processDefinition.getExecutionType());
}
}
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
if (file != null) {
if (!upload(loginUser, fullName, file, type)) {
log.error("Storage operation error, resourceName:{}, originFileName:{}.",
name, RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.HDFS_OPERATION_ERROR);
throw new ServiceException(
String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
}
if (!fullName.equals(originFullName)) {
try {
storageOperate.delete(originFullName, false);
} catch (IOException e) {
log.error("Resource delete error, resourceFullName:{}.", originFullName, e);
throw new ServiceException(String.format("delete resource: %s failed.", originFullName));
}
}
return result;
}
String destHdfsFileName = fullName;
try {
log.info("start copy {} -> {}", originFullName, destHdfsFileName);
storageOperate.copy(originFullName, destHdfsFileName, true, true);
} catch (Exception e) {
log.error(MessageFormat.format(" copy {0} -> {1} fail", originFullName, destHdfsFileName), e);
putMsg(result, Status.HDFS_COPY_FAIL);
throw new ServiceException(MessageFormat.format(
Status.HDFS_COPY_FAIL.getMsg(), originFullName, destHdfsFileName));
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
return result;
}
private Result<Object> verifyFile(String name, ResourceType type, MultipartFile file) {
Result<Object> result = new Result<>();
putMsg(result, Status.SUCCESS);
if (FileUtils.directoryTraversal(name)) {
log.warn("Parameter file alias name verify failed, fileAliasName:{}.", RegexUtils.escapeNRT(name));
putMsg(result, Status.VERIFY_PARAMETER_NAME_FAILED);
return result;
}
if (file != null && FileUtils.directoryTraversal(Objects.requireNonNull(file.getOriginalFilename()))) {
log.warn("File original name verify failed, fileOriginalName:{}.",
RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.VERIFY_PARAMETER_NAME_FAILED);
return result;
}
if (file != null) {
if (file.isEmpty()) {
log.warn("Parameter file is empty, fileOriginalName:{}.",
RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.RESOURCE_FILE_IS_EMPTY);
return result;
}
String fileSuffix = Files.getFileExtension(file.getOriginalFilename());
String nameSuffix = Files.getFileExtension(name);
if (!fileSuffix.equalsIgnoreCase(nameSuffix)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
log.warn("Rename file suffix and original suffix must be consistent, fileOriginalName:{}.",
RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE);
return result;
}
if (Constants.UDF.equals(type.name()) && !JAR.equalsIgnoreCase(fileSuffix)) {
log.warn(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg());
putMsg(result, Status.UDF_RESOURCE_SUFFIX_NOT_JAR);
return result;
}
if (file.getSize() > Constants.MAX_FILE_SIZE) {
log.warn(
"Resource file size is larger than max file size, fileOriginalName:{}, fileSize:{}, maxFileSize:{}.",
RegexUtils.escapeNRT(file.getOriginalFilename()), file.getSize(), Constants.MAX_FILE_SIZE);
putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT);
return result;
}
}
return result;
}
/**
* query resources list paging
*
* @param loginUser login user
* @param fullName resource full name
* @param resTenantCode tenantCode in the request field "resTenantCode" for tenant code owning the resource,
* can be different from the login user in the case of logging in as admin users.
* @param type resource type
* @param searchVal search value
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
* @param pageNo page number
* @param pageSize page size
* @return resource list page
*/
@Override
public Result<PageInfo<StorageEntity>> queryResourceListPaging(User loginUser, String fullName,
String resTenantCode,
ResourceType type, String searchVal, Integer pageNo,
Integer pageSize) {
Result<PageInfo<StorageEntity>> result = new Result<>();
PageInfo<StorageEntity> pageInfo = new PageInfo<>(pageNo, pageSize);
if (storageOperate == null) {
log.warn("The resource storage is not opened.");
return Result.success(pageInfo);
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
log.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return result;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
log.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return result;
}
String tenantCode = tenant.getTenantCode();
if (!isUserTenantValid(isAdmin(loginUser), tenantCode, resTenantCode)) {
log.error("current user does not have permission");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
String defaultPath = "";
List<StorageEntity> resourcesList = new ArrayList<>();
String resourceStorageType =
PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE, ResUploadType.NONE.name());
if (isAdmin(loginUser) && StringUtils.isBlank(fullName)) {
List<User> userList = userMapper.selectList(null);
Set<String> visitedTenantEntityCode = new HashSet<>();
for (User userEntity : userList) {
String tenantEntityCode = tenantMapper.queryById(userEntity.getTenantId()).getTenantCode();
if (!visitedTenantEntityCode.contains(tenantEntityCode)) {
defaultPath = storageOperate.getResDir(tenantEntityCode);
if (type.equals(ResourceType.UDF)) {
defaultPath = storageOperate.getUdfDir(tenantEntityCode);
}
try {
resourcesList.addAll(storageOperate.listFilesStatus(defaultPath, defaultPath,
tenantEntityCode, type));
visitedTenantEntityCode.add(tenantEntityCode);
} catch (Exception e) {
log.error(e.getMessage() + " Resource path: {}", defaultPath, e);
putMsg(result, Status.RESOURCE_NOT_EXIST);
throw new ServiceException(String.format(e.getMessage() +
" make sure resource path: %s exists in %s", defaultPath, resourceStorageType));
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
} else {
defaultPath = storageOperate.getResDir(tenantCode);
if (type.equals(ResourceType.UDF)) {
defaultPath = storageOperate.getUdfDir(tenantCode);
}
try {
if (StringUtils.isBlank(fullName)) {
resourcesList = storageOperate.listFilesStatus(defaultPath, defaultPath, tenantCode, type);
} else {
resourcesList = storageOperate.listFilesStatus(fullName, defaultPath, tenantCode, type);
}
} catch (Exception e) {
log.error(e.getMessage() + " Resource path: {}", fullName, e);
putMsg(result, Status.RESOURCE_NOT_EXIST);
throw new ServiceException(String.format(e.getMessage() +
" make sure resource path: %s exists in %s", defaultPath, resourceStorageType));
}
}
String trimmedSearchVal = searchVal != null ? searchVal.trim() : "";
List<StorageEntity> filteredResourceList = resourcesList.stream()
.filter(x -> x.getFileName().contains(trimmedSearchVal)).collect(Collectors.toList());
List<StorageEntity> slicedResourcesList = filteredResourceList.stream().skip((long) (pageNo - 1) * pageSize)
.limit(pageSize).collect(Collectors.toList());
pageInfo.setTotal(filteredResourceList.size());
pageInfo.setTotalList(slicedResourcesList);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
return result;
}
/**
* create directory
* xxx The steps to verify resources are cumbersome and can be optimized
*
* @param loginUser login user
* @param fullName full name
* @param type resource type
* @param result Result
*/
private void createDirectory(User loginUser, String fullName, ResourceType type, Result<Object> result) {
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String resourceRootPath = storageOperate.getDir(type, tenantCode);
try {
if (!storageOperate.exists(resourceRootPath)) {
storageOperate.createTenantDirIfNotExists(tenantCode);
}
if (!storageOperate.mkdir(tenantCode, fullName)) {
log.error("create resource directory {} failed", fullName);
putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
}
} catch (Exception e) {
log.error("create resource directory {} failed", fullName);
putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
throw new ServiceException(String.format("create resource directory: %s failed.", fullName));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
/**
* upload file to hdfs
*
* @param loginUser login user
* @param fullName full name
* @param file file
* @param type resource type
* @return upload success return true, otherwise false
*/
private boolean upload(User loginUser, String fullName, MultipartFile file, ResourceType type) {
String fileSuffix = Files.getFileExtension(file.getOriginalFilename());
String nameSuffix = Files.getFileExtension(fullName);
if (!fileSuffix.equalsIgnoreCase(nameSuffix)) {
return false;
}
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString());
String resourcePath = storageOperate.getDir(type, tenantCode);
try {
if (!storageOperate.exists(resourcePath)) {
storageOperate.createTenantDirIfNotExists(tenantCode);
}
org.apache.dolphinscheduler.api.utils.FileUtils.copyInputStreamToFile(file, localFilename);
storageOperate.upload(tenantCode, localFilename, fullName, true, true);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
} catch (Exception e) {
FileUtils.deleteFile(localFilename);
log.error(e.getMessage(), e);
return false;
}
return true;
}
/**
* query resource list
*
* @param loginUser login user
* @param type resource type
* @param fullName resource full name
* @return resource list
*/
@Override
public Map<String, Object> queryResourceList(User loginUser, ResourceType type, String fullName) {
Map<String, Object> result = new HashMap<>();
if (storageOperate == null) {
result.put(Constants.DATA_LIST, Collections.emptyList());
result.put(Constants.STATUS, Status.SUCCESS);
return result;
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
log.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return null;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 13,651 |
[Improvement][Resource Center] Remove useless table t_ds_relation_resources_task
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
In new resource center, task can download resources directly by `fullName`, also, according to discussion before (https://github.com/apache/dolphinscheduler/pull/13593#issuecomment-1438045083), when delete or update resource, we don't have to check online status of the related task. In this way, `t_ds_relation_resources_task` is useless, DS doesn't have to keep the relation of task and resource.
Can we remove table `t_ds_relation_resources_task` and correlative entity, which can simplify code logic in resource center?
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/13651
|
https://github.com/apache/dolphinscheduler/pull/13721
|
41801663fdc1b265df8e105680d3c53f8923c724
|
8895921d87ad34d5dc98f69ab024a28a1e6b1598
| 2023-03-01T09:23:18Z |
java
| 2023-03-23T14:52:23Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
if (tenant == null) {
log.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return null;
}
String tenantCode = tenant.getTenantCode();
String defaultPath = "";
List<StorageEntity> resourcesList = new ArrayList<>();
if (StringUtils.isBlank(fullName)) {
if (isAdmin(loginUser)) {
List<User> userList = userMapper.selectList(null);
Set<String> visitedTenantEntityCode = new HashSet<>();
for (User userEntity : userList) {
String tenantEntityCode = tenantMapper.queryById(userEntity.getTenantId()).getTenantCode();
if (!visitedTenantEntityCode.contains(tenantEntityCode)) {
defaultPath = storageOperate.getResDir(tenantEntityCode);
if (type.equals(ResourceType.UDF)) {
defaultPath = storageOperate.getUdfDir(tenantEntityCode);
}
resourcesList.addAll(storageOperate.listFilesStatusRecursively(defaultPath, defaultPath,
tenantEntityCode, type));
visitedTenantEntityCode.add(tenantEntityCode);
}
}
} else {
defaultPath = storageOperate.getResDir(tenantCode);
if (type.equals(ResourceType.UDF)) {
defaultPath = storageOperate.getUdfDir(tenantCode);
}
resourcesList = storageOperate.listFilesStatusRecursively(defaultPath, defaultPath, tenantCode, type);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.