Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement][Master] switch task doesn't support includes function #16534

Closed
3 tasks done
ChaoquanTao opened this issue Aug 28, 2024 · 4 comments · Fixed by #16594
Closed
3 tasks done

[Improvement][Master] switch task doesn't support includes function #16534

ChaoquanTao opened this issue Aug 28, 2024 · 4 comments · Fixed by #16594
Assignees
Labels
good first issue good first issue improvement make more easy to user or prompt friendly

Comments

@ChaoquanTao
Copy link
Contributor

Search before asking

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

Description

I want to execute condition like ['abc','def'].includes(${output}) in switch task, but error occurs:

javax.script.ScriptException: TypeError: ["abc", "efg"].includes is not a function in <eval> at line number 1
	at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:454)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
	at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
	at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
	at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
	at org.apache.dolphinscheduler.server.master.utils.SwitchTaskUtils.evaluate(SwitchTaskUtils.java:35)

Actually the includes function can be supported by using polyfills as https://stackoverflow.com/questions/47543566/scriptengine-javascript-doesnt-support-includes mentioned.

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@ChaoquanTao ChaoquanTao added improvement make more easy to user or prompt friendly Waiting for reply Waiting for reply labels Aug 28, 2024
@SbloodyS
Copy link
Member

Can you provide reproduce steps?

@SbloodyS SbloodyS added need more information and removed Waiting for reply Waiting for reply labels Aug 28, 2024
@ChaoquanTao
Copy link
Contributor Author

create a workflow containing a switch task. set the condition like ['abc','def'].includes('abc'), and you will get the exception. I use the 3.2.0 version, and I also tried in 3.2.2, same situation.

@SbloodyS
Copy link
Member

SbloodyS commented Sep 2, 2024

I see. Would you like to fix it? @ChaoquanTao

@SbloodyS SbloodyS added good first issue good first issue and removed need more information labels Sep 2, 2024
@ChaoquanTao
Copy link
Contributor Author

no problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue good first issue improvement make more easy to user or prompt friendly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants