Skip to content

[Bug] [Task] Can‘t execute Datax shell when 'Global Variables' contains space in Workflow Definition #15095

@jfifth

Description

@jfifth

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

Datax shell cannot run when 'Global Variables' contains space in Workflow Definition(I can't access the production environment right now to provide detailed exception information and screenshot). eg:

'Global Variables' name: std.start.time
The value of the first type global variable:$[yyyy-MM-dd HH:00:00]
The value of the second type global variable(Added single quotes):'$[yyyy-MM-dd HH:00:00]'

The first type of DS generated Datax shell scripts:
${PYTHON_LAUNCHER} ${DATAX_LAUNCHER} --jvm="-Xms1G -Xmx1G" -p "-Dstd.start.time='2023-10-26 14:00:00' -DStartParams='{"std.start.time":"2023-10-26 14:00:00"}'
The Dstd.start.time value has single quotes,and std.start.time in DStartParams doesn‘t have single quotes. The Datax shell can't run success.

The second type of DS generated Datax shell scripts:
${PYTHON_LAUNCHER} ${DATAX_LAUNCHER} --jvm="-Xms1G -Xmx1G" -p "-Dstd.start.time=''2023-10-26 14:00:00'' -DStartParams='{"std.start.time":"'2023-10-26 14:00:00'"}'
The Dstd.start.time value has DOUBLE single quotes.Datax shell also doesn't work.

What you expected to happen

I found that the CUSTOM_PARAM attribute in the org.apache.dolphinscheduler.plugin.task.datax.DataxTask class adds the single quote:
public static final String CUSTOM_PARAM = " -D%s='%s'";

It works fine after this modification (the code is poorly written):
微信截图_20231030165108

How to reproduce

Use global variables with spaces value in process definitions that contain Datax tasks

Anything else

no

Version

3.2.x

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalebugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions