apache / apache/dolphinscheduler

[DSIP-89][SqlTask] Avoid using PrepareStatement in SqlTask

Open
#17,263 4 comments 0 reactions 0 assignees View on GitHub
DSIP priority:middle
Dominant language
Java
Stars
14.5k
Forks
5.1k
Avg merge
1d 21h
Merged PRs (30d)
29

Description

### Search before asking

- [x] I had searched in the [DSIP](https://github.com/apache/dolphinscheduler/issues/14102) and found no similar DSIP.

### Motivation

Right now we're using PrepareStatement in SqlTask, and if we find the sql contains `${xx}` will using `?` to replase `${xx}` and set the value in `PrepareStatement`.

There might exist a lot of bug in this way, some are from DS, some are from third-part driver.
e.g. #17124

So it's better to directly replace the value in sql rather than using Preparement.

### Design Detail

_No response_

### Compatibility, Deprecation, and Migration Plan

_No response_

### Test Plan

_No response_

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Start at the SqlTask implementation and trace where PrepareStatement handles SQL containing ${xx}; review issue #17124 for the reported failure mode. Clarify how values should be replaced before changing the execution path, then verify that affected SQL runs correctly without PrepareStatement and that existing SqlTask behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
backend, databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.