Repository navigation
Conversation
Keep sql-client.sh when sqlSubmitType is absent or CLIENT. SQL_GATEWAY submits over JDBC and cancels the statement.
macdoor
requested review from
Gallardot,
SbloodyS and
caishunfeng
as code owners
October 10, 2026 08:17
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was this PR generated or assisted by AI?
YES — the SQL Gateway submit path, UI fields, and unit tests were assisted by an AI agent (Hermes). All changes were human-reviewed and verified by build + unit tests plus a smoke run on an internal cluster.
Purpose of the pull request
Add an optional SQL Gateway submit mode to the existing FLINK task, so batch SQL can be sent to a remote Flink SQL Gateway through its JDBC driver (
flink-sql-jdbc-driver), enabling DolphinScheduler to schedule batch SQL workloads without a local Flink client installation.Today the
FLINKtask runs SQL through${FLINK_HOME}/bin/sql-client.sh, which requires a full Flink distribution on every worker host. Deployments that run a dedicated Flink SQL Gateway cluster instead can submit scripts straight to the Gateway over JDBC.Compared with spawning
sql-client.shon the worker, submitting through the SQL Gateway costs less memory on the worker host (no local Flink CLI/mini-cluster JVM per task), produces clearer errors (statement-level JDBC exceptions instead of parsing shell/YARN logs), and is faster (no CLI process startup and script materialization per statement).The new mode is opt-in via a
sqlSubmitTypeparameter: absent orCLIENTkeeps the existingsql-client.shpath unchanged;SQL_GATEWAYsubmits over JDBC.Brief change log
FlinkParameters.sqlSubmitType: absent /CLIENTkeeps${FLINK_HOME}/bin/sql-client.sh;SQL_GATEWAYsubmits over JDBC and cancels viastatement.cancel()FlinkTask.handle()/cancelApplication().getScript()andFlinkArgsUtilsare unchanged, so existing CLIENT behavior and FLINK_STREAM are untouchedorg.apache.dolphinscheduler.plugin.task.api.enums.SqlSourceType(SCRIPT/FILE, introduced by [Improvement-18019][task-sql] Support SQL from resource file and parameter placeholders #18020) for both the init script and the main script, and the JDBC URL and script content resolve parameter placeholders (e.g.${var}) before submission; statement splitting and leading-comment stripping are package-private static methods covered by plain JUnit tests (no Mockito);); optionalmaxPrintRowscaps query-result row logging;flinkJdbcUrlsupports parameter placeholders; optionaljdbcPropertiesmap filters null keys/values before connectdolphinscheduler-task-flink;dolphinscheduler-task-flink-streamexcludes it so its shade jar stays free of the driverSQLand submit type is SQL Gateway;use-resourcesfield helper gains optionalfield/limitparameters to support the init-script resource field; locales (en/zh)Verify this pull request
This change added tests and can be verified as follows:
mvn test -pl dolphinscheduler-task-plugin/dolphinscheduler-task-flink -Dtest=FlinkParametersTest,FlinkSqlGatewayExecutorTest,FlinkArgsUtilsTest,FlinkTaskTest -Dspotless.skip=true -Djacoco.skip=truemvn -pl dolphinscheduler-task-plugin/dolphinscheduler-task-flink,dolphinscheduler-task-plugin/dolphinscheduler-task-flink-stream spotless:checkFLINKtask withsqlSubmitType=SQL_GATEWAYwas executed on an internal cluster (worker-only smoke): the task instance ranFlinkSqlGatewayExecutor, connected tojdbc:flink://...:8083, executed init + main scripts from resource-center files, and cancelled viastatement.cancel()