nanxiuzi opened a new issue, #18446:
URL: https://github.com/apache/dolphinscheduler/issues/18446
## Summary
When using the SQL task node's "Resource File" mode (introduced in #18019),
selecting a SQL resource file and saving the node results in the selection
being lost on reopen. The node reverts to "Script" mode and the resource file
path is empty.
## Expected Behavior
After saving the SQL task node, reopening it should preserve both the SQL
source mode (`sqlSource`) and the selected resource file path (`sqlResource`).
## How to Reproduce
1. Open a workflow definition for editing.
2. Drag a SQL task onto the canvas and open it.
3. In the SQL task form, set "SQL Source" to "File".
4. Pick a `.sql` resource file from the resource tree.
5. Save the node and the workflow definition.
6. Reopen the SQL task node for editing.
7. Observe: "SQL Source" has reverted to "Script", and the resource file
path is empty.
8. In DevTools → Network, inspect the `workflow-definition` (or
`task-definition`) response. The `taskDefinitionJson.taskParams` object is
missing `sqlSource` and `sqlResource`.
## Root Cause
In
`dolphinscheduler-ui/src/views/projects/task/components/node/format-data.ts`,
the SQL branch of `formatParams()` serializes `sql`, `sqlType`,
`preStatements`, `postStatements`, `sendEmail`, `displayRows`, `title`,
`groupId` — but does not serialize `sqlSource` or `sqlResource`:
```ts
if (data.taskType === 'SQL') {
taskParams.type = data.type
taskParams.datasource = data.datasource
taskParams.sql = data.sql
taskParams.sqlType = data.sqlType
// ... missing sqlSource and sqlResource
}
```
The form fields are defined in `use-sql.ts` (around lines 65 and 95), so the
UI displays them, but they never get written to `taskParams` on save.
The backfill path in `formatModel()` (`format-data.ts` around line 549) does:
```ts
...omit(data.taskParams, ['resourceList', 'mainJar', 'localParams'])
```
so any field that IS in `taskParams` gets restored transparently. The bug is
purely that the fields are not serialized in `formatParams` in the first place.
## Environment
- DolphinScheduler 3.4.2 release (also reproduced on the latest `dev`
branch, commit `3752346650`)
- Resource storage: OSS (the bug is independent of storage type but is most
visible when using remote resource storage)
- Browser: any
## Related
- Feature introduced in #18019 (`[Improvement][task-sql] Support executing
SQL from resource center file`) — the implementation added the form fields but
missed the serialization.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]