[improve-#13665] improve datax parser if sql contain * (#13680)

* [improve-#13665] improve datax parser if sql contain *

* Update dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java

Co-authored-by: fuchanghai <‘2875334588@qq.com’>
Co-authored-by: Aaron Wang <wangweirao16@gmail.com>
This commit is contained in:
fuchanghai 2023-03-07 11:16:53 +08:00 committed by GitHub
parent 35d8e8ac17
commit 6218f818c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,6 +90,11 @@ public class DataxTask extends AbstractTask {
*/
private static final String DATAX_PYTHON = "python2.7";
private static final Pattern PYTHON_PATH_PATTERN = Pattern.compile("/bin/python[\\d.]*$");
/**
* select all
*/
private static final String SELECT_ALL_CHARACTER = "*";
/**
* datax path
*/
@ -538,6 +543,11 @@ public class DataxTask extends AbstractTask {
String.format("grammatical analysis sql column [ %s ] failed", item));
}
if (SELECT_ALL_CHARACTER.equals(item.toString())) {
log.info("sql contains *, grammatical analysis failed");
return new String[0];
}
if (columnName == null) {
throw new RuntimeException(
String.format("grammatical analysis sql column [ %s ] failed", item));