close
Skip to content

[Improve][Connector-V2] Optimize dialect selection in jdbc#8820

Merged
hailin0 merged 6 commits into
apache:devfrom
corgy-w:jdbc-dialect
Apr 2, 2025
Merged

[Improve][Connector-V2] Optimize dialect selection in jdbc#8820
hailin0 merged 6 commits into
apache:devfrom
corgy-w:jdbc-dialect

Conversation

@corgy-w

@corgy-w corgy-w commented Feb 25, 2025

Copy link
Copy Markdown
Contributor

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

Comment thread docs/en/connector-v2/sink/Jdbc.md Outdated
Comment thread docs/en/connector-v2/sink/Jdbc.md Outdated
Comment thread docs/en/connector-v2/sink/Jdbc.md Outdated
Comment thread docs/en/connector-v2/source/Jdbc.md
@corgy-w corgy-w requested a review from Hisoka-X March 18, 2025 06:55
@hailin0

hailin0 commented Apr 1, 2025

Copy link
Copy Markdown
Member

waiting ci passed

@hailin0 hailin0 requested a review from Copilot April 1, 2025 14:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes JDBC dialect selection by introducing a dedicated dialect configuration that takes precedence over URL inspection. Key changes include:

  • Adding a new method (dialectFactoryName) across various dialect factory classes.
  • Enhancing JdbcDialectLoader to select the appropriate dialect based on an explicit configuration.
  • Updating configuration classes and documentation to support the new dialect option.

Reviewed Changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

File Description
connector-jdbc/internal/dialect/* Adds the dialectFactoryName() method to all dialect factories, returning the corresponding identifier from DatabaseIdentifier.
JdbcDialectLoader.java Overloads and adjusts the load() method to allow explicit selection via a new dialect parameter.
JdbcOptions.java, JdbcConnectionConfig.java Introduces a new configuration option ("dialect") to support explicit dialect selection.
docs/* Updates documentation to reflect the new dialect configuration option.
Comments suppressed due to low confidence (1)

seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/JdbcDialectLoader.java:65

  • Consider enhancing the check for 'dialect' to also verify that it is not an empty or blank string. For example: 'if (dialect != null && !dialect.trim().isEmpty()) {'.
if (dialect != null) {

| password | String | No | - | password |
| query | String | No | - | Query statement |
| compatible_mode | String | No | - | The compatible mode of database, required when the database supports multiple compatible modes.<br/> For example, when using OceanBase database, you need to set it to 'mysql' or 'oracle'. <br/> when using starrocks, you need set it to `starrocks` |
| dialect | String | No | - | The appointed dialect, if it does not exist, is still obtained according to the url, and the priority is higher than the url. <br/> For example,when using starrocks, you need set it to `starrocks` |

Copilot AI Apr 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] There is a missing space after the comma in 'For example,when using starrocks,'.

Suggested change
| dialect | String | No | - | The appointed dialect, if it does not exist, is still obtained according to the url, and the priority is higher than the url. <br/> For example,when using starrocks, you need set it to `starrocks` |
| dialect | String | No | - | The appointed dialect, if it does not exist, is still obtained according to the url, and the priority is higher than the url. <br/> For example, when using starrocks, you need set it to `starrocks` |

Copilot uses AI. Check for mistakes.
@hailin0 hailin0 merged commit 92c62c5 into apache:dev Apr 2, 2025
@corgy-w corgy-w deleted the jdbc-dialect branch January 28, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants