silvermissile opened a new pull request, #18727:
URL: https://github.com/apache/dolphinscheduler/pull/18727

   ## Was this PR generated or assisted by AI?
   
   YES. Implementation, regression tests, and documentation were AI-assisted.
   
   ## Purpose of the pull request
   
   Closes #18725.
   
   Allow users to configure a complete Kyuubi JDBC URL through the datasource 
UI and REST API, without editing the metadata database. The existing form 
constructs a URL from host, port, database and `other`, appending `other` as 
semicolon-separated client properties. It cannot express session properties in 
their intended URL position.
   
   For example, users can now select **JDBC URL** and enter:
   
   ```text
   
jdbc:kyuubi://kyuubi-server:10009/default;socketTimeout=600000?kyuubi.engine.share.level=USER;kyuubi.engine.share.level.subdomain=example
   ```
   
   ### Scope and design choices
   
   - **KYUUBI only.** The HIVE datasource remains unchanged, including HIVE 
records that happen to connect to a Kyuubi endpoint. This keeps Hive-specific 
behavior outside this change.
   - **Use the existing Kyuubi driver.** 
`org.apache.kyuubi.jdbc.KyuubiHiveDriver` already understands complete 
connection URLs. The plugin passes the URL through rather than reconstructing 
its property segments. The configured JDBC dependency remains 1.7.0; this PR 
does not upgrade the driver or server.
   - **Follow Kyuubi's public terminology.** The [1.12.0 JDBC 
documentation](https://kyuubi.readthedocs.io/en/v1.12.0/client/jdbc/kyuubi_jdbc.html#basic-connection-url-format)
 describes `clientProperties` and `sessionProperties`, with either `?` or `#` 
introducing session properties. This refines the original issue's segment 
terminology: the implementation does not assign separate business meanings to 
`?` and `#`, or expose the driver's internal Hive-named maps as new API fields.
   - **One optional field instead of several property maps.** `rawJdbcUrl` is 
added to `KyuubiDataSourceParamDTO` and `KyuubiConnectionParam`. It preserves a 
driver-supported URL and avoids duplicating the driver's URL serialization 
rules in DolphinScheduler. Existing create/update/connection-test endpoints 
accept the optional field; no new endpoint is needed.
   
   ### Persistence, precedence and compatibility
   
   1. A missing, empty or whitespace-only `rawJdbcUrl` uses the existing 
standard configuration path. Old API requests and saved connection-parameters 
JSON continue to work without being rewritten.
   2. A nonblank `rawJdbcUrl` is trimmed at its outer boundaries and is 
authoritative. It is stored as another key in the existing 
connection-parameters JSON, with `jdbcUrl` synchronized to that complete URL. 
No database column, DDL or data migration is required.
   3. In URL mode, legacy host/port/database/`other` input does not override 
the URL. `other` is neither appended nor injected as additional driver 
properties. This avoids stale form values silently changing a connection.
   4. On reading stored JSON, `jdbcUrl` is synchronized again from 
`rawJdbcUrl`. The existing datasource cache identity therefore includes the 
full URL, so different engine-routing URLs do not reuse a pool keyed only by 
the old base address. No shared cache-key algorithm is changed.
   5. Standard configuration remains the default. Editing a saved URL-mode 
datasource restores its URL; switching back to standard configuration requires 
valid standard fields. The connection-mode selector is UI state and is not 
persisted or sent as an API field.
   
   Compatibility here means **old configurations remain usable after 
upgrading**. API servers and workers need the updated plugin before URL mode is 
enabled. Round-tripping newly created URL-mode records through an older plugin 
is not guaranteed. Driver/server capabilities still determine which discovery, 
catalog, transport and authentication options actually work.
   
   ### Validation and credentials
   
   - Syntax validation uses the installed Kyuubi driver's component extractor, 
without resolving ZooKeeper or contacting a server while constructing 
datasource parameters. Connectivity remains the connection-test operation's 
responsibility.
   - Username and password stay in DolphinScheduler's existing credential 
fields and password handling. URL client properties named `user` or `password` 
are rejected, so credentials do not bypass that handling. Parse errors are 
returned without echoing the supplied URL or the driver's original 
exception/cause.
   - The Kyuubi edit form clears the returned password placeholder instead of 
submitting it as a new password. Leaving it blank preserves the saved password 
on update; testing an edited connection requires re-entering the password, as 
explained in the form.
   
   ## Brief change log
   
   - Add optional raw-URL handling to the Kyuubi request DTO, persisted 
connection parameters and processor, while retaining the legacy path.
   - Add Kyuubi standard/URL configuration modes, mode-specific validation and 
request serialization, and English/Chinese form text.
   - Add processor and pool regression coverage and document configuration, 
precedence, credentials and rollout requirements in English and Chinese.
   
   ## Verify this pull request
   
   This change adds tests and has been verified as follows.
   
   ### Automated checks
   
   - Kyuubi tests with the default JDBC driver **1.7.0**: **42 passed**, no 
failures/errors/skips; module packaging succeeded.
   - The same tests with JDBC driver **1.12.0**, selected only via a Maven 
property: **42 passed**, no failures/errors/skips. The committed dependency 
version is unchanged.
   - Coverage includes old requests and stored JSON, blank-field fallback, URL 
persistence/edit round trips, trimming, raw-over-legacy precedence, `?`/`#` 
driver parsing, invalid input without URL disclosure, direct connection 
URL/credential forwarding, stale-property exclusion from pools, distinct 
routing URL cache identities, and switching back to standard mode.
   - Catalog/schema paths, HTTP, ZooKeeper quorum URLs and IPv6 are covered at 
the parsing/round-trip level. These tests do not establish live connectivity 
for every topology or authentication mechanism.
   - `./mvnw spotless:apply` was run before committing; formatting checks and 
`git diff --check` passed.
   - ESLint on the changed UI files and `pnpm run build:prod` (including 
TypeScript checks) passed.
   
   Reproduce the focused backend checks with JDK 11:
   
   ```sh
   ./mvnw -B -pl 
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-kyuubi -am clean 
package -Dtest='Kyuubi*Test' -Dsurefire.failIfNoSpecifiedTests=false
   ./mvnw -B -pl 
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-kyuubi -am clean 
test -Dtest='Kyuubi*Test' -Dsurefire.failIfNoSpecifiedTests=false 
-Dkyuubi-jdbc.version=1.12.0
   ```
   
   ### Manual integration validation
   
   The change was also backported to a matching **DolphinScheduler 3.4.1** 
build for a separate integration exercise using **Kyuubi Server 1.11.1** and 
**JDBC driver 1.7.0**. This supplements the tests of the submitted `dev` 
implementation; it is not a claim that the `dev` distribution itself was 
deployed.
   
   - A legacy datasource created through the original implementation was used 
by the updated worker **without resaving it**; `SELECT 1` succeeded.
   - New datasources using both `?` and `#` were created, persisted, reopened 
and tested successfully; stored raw and runtime URLs agreed.
   - A workflow's four SQL tasks passed: a legacy `SELECT 1`, a URL-mode 
`SELECT 1`, and two `SET spark.app.name` checks returning the respective 
configured application names. The latter ran through the same worker process to 
exercise separate URL-based pool identities and effective session configuration.
   - UI checks covered the default standard form, URL mode, hidden standard 
fields, empty-URL validation, editing and switching modes. Metadata-only edits 
with a blank password retained the saved credentials for both legacy and 
URL-mode records.
   
   Review feedback is especially welcome on the optional field/persistence 
contract, raw-over-legacy precedence, and keeping credentials in the existing 
fields. Those choices aim to make the new behavior explicit while preserving 
existing installations.
   
   ## Pull Request Notice
   
   [Pull Request 
Notice](https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md)
   


-- 
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]

Reply via email to