Repository navigation
[Improve][Connector-V2] Move numeric_special_value_as_null to JdbcSourceOptions - #12989
Conversation
…rceOptions The option only applies to reading PostgreSQL numeric special values and is declared by the Jdbc source only. Defining it in JdbcCommonOptions made it visible through JdbcSinkOptions, so JdbcOptionRuleCompletenessTest had to exclude it from the sink check. Moving it to JdbcSourceOptions makes the exclusion unnecessary; testNumericSpecialValueAsNullIsSourceOnly still checks that the source accepts the key and the sink rejects it. Key, type, default and description are unchanged.
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for splitting this out as a follow-up, @fatmanverse. This is a clean, well-scoped change and the impact analysis in the description matches what I found in the source.
What problem does this PR solve
- Pain point:
numeric_special_value_as_null(#12792) is only meaningful for reading PostgreSQL numeric special values, and onlyJdbcSourceFactorydeclares it. Because it was defined inJdbcCommonOptions,JdbcSinkOptionsinherited it andJdbcOptionRuleCompletenessTestneeded aNOT_SINK_OPTIONSexclusion to hide that. - Fix approach: define the option in
JdbcSourceOptions(key, type, default and description unchanged), repoint the three references inJdbcConnectionConfig, and drop the test-side exclusion. - One sentence: the option now lives where it applies, so sink option collection no longer sees a source-only key.
1 Code change review
Core logic
Before:
// JdbcCommonOptions
public static final Option<Boolean> NUMERIC_SPECIAL_VALUE_AS_NULL = Options.key("numeric_special_value_as_null")...After: the same declaration, verbatim, in JdbcSourceOptions. JdbcConnectionConfig (field default, of(), builder default) now reads JdbcSourceOptions.NUMERIC_SPECIAL_VALUE_AS_NULL.
What I verified at the head commit:
git grepforNUMERIC_SPECIAL_VALUE_AS_NULL/numeric_special_value_as_nullshows no remaining reference toJdbcCommonOptions.NUMERIC_SPECIAL_VALUE_AS_NULLanywhere in main, test or e2e code.JdbcSourceFactoryalready referencedJdbcSourceOptions.NUMERIC_SPECIAL_VALUE_AS_NULL, which now resolves to the declared field directly instead of the inherited one.- The option is still declared in the source factory rule (
JdbcSourceFactoryoptionRule), so--check/--dry-runcontinues to accept it for the source. - The two PostgreSQL E2E configs (
jdbc_postgres_source_and_sink_numeric_special_value*.conf) set the key inside thejdbc { ... }source block only, so no E2E config is affected by the sink now rejecting it. (The sink already rejected it before this PR, becauseJdbcSinkFactorynever declared it.) - The sink path:
JdbcConnectionConfig.of(config)is shared by source and sink; the sink config never carries the key, sogetOptionalreturns empty and the defaultfalseapplies. Behavior is unchanged. - Documentation: the option is documented in
docs/enanddocs/zhconnectors/source/Jdbc.mdonly, which is now consistent with where the option is defined.
Runtime path
Normal source path: JdbcSourceFactory option rule -> JdbcConnectionConfig.of(config) -> numericSpecialValueAsNull -> PostgresJdbcRowConverter. Only the constant's owning class changes; the key and value flow are identical, so this is a pure refactor with no runtime effect.
Compatibility
Fully compatible. The option key, type, default and description are unchanged. The only moved symbol is a Java constant. git tag --contains on the #12792 commit lists no release, so no released public constant moves (this agrees with the description). JdbcCommonOptions.NUMERIC_SPECIAL_VALUE_AS_NULL is no longer reachable, but I found no external user in the repo.
Performance and side effects
None. One trivial note: JdbcConnectionConfig, which is also used on the sink side, now touches JdbcSourceOptions for the default. Class initialization of that options class is cheap and is already triggered by the source factory in the same module.
Error handling and logging
No change.
Issues
No blocking or non-blocking issues found.
2 Code quality
- Standards: change follows the existing option layout; no new files, so no license header concerns; imports are unchanged (same package).
- Tests:
JdbcOptionRuleCompletenessTestis strengthened rather than weakened in intent: the sink completeness check now runs over the fullJdbcSinkOptionskey set with an empty exclusion set, andtestNumericSpecialValueAsNullIsSourceOnlystill asserts that the source accepts the key and the sink rejects it. If someone moves the option back into the common class, the sink completeness test turns red; if someone removes it from the source rule, the source test turns red. - Stability rating: Stable. Pure reflection and rule validation, no timing, no shared state, no containers.
- Docs: no update needed (en and zh unchanged and still accurate).
3 Architecture
- Precise fix of the option ownership. It is the root-cause fix for the test exclusion rather than a workaround.
- Maintainability: improves it, since the shared class again holds only genuinely shared options and the test needs no special case.
- Extensibility: future source-only options have a clear precedent.
- Historical compatibility: no user-visible change.
4 Issue summary
| # | Severity | Item | Blocking |
|---|---|---|---|
| - | - | None | - |
5 Merge recommendation
Conclusion: Ready to merge
Blockers: none from the code side.
Recommended non-blocking fixes: none.
CI: there is no Build check on the apache side yet for this head; the fork run is queued (https://github.com/fatmanverse/seatunnel/actions/runs/40302163202). Please make sure it finishes green before merge.
Overall: a minimal, behavior-preserving cleanup with solid test coverage. Nice work.
|
Thanks for the contribution. The CI fact cited in my previous conclusion has changed; this follow-up updates that gate on the unchanged reviewed head, without issuing another full source review. Gate snapshot (2026-10-28T15:43:10+00:00), head CI was previously the only remaining technical gate in my conclusion; CI is now passing, so that CI objection is withdrawn and my technical conclusion is clear to proceed. Daniel currently has READ permission. I have not changed the effective GitHub review state to APPROVED; a write-capable maintainer must perform the final approve/dismiss action required by branch protection. Comparison recorded in this scan: base |
|
Hi, this PR has been green and marked ready by @DanielLeens since 2026-10-28, and it still merges cleanly with current |
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for your patience and for the follow-up. My earlier review of this exact head found no blockers and only noted that CI was still queued. The fork Build and the apache-side Build have both completed successfully on this head. The branch merges cleanly, though it is 62 commits behind dev. Nothing further from my side; approving.
Conclusion: Ready to merge
Blockers: none. Recommended non-blocking fixes: none beyond the optional Low items in my earlier review.
davidzollo
left a comment
There was a problem hiding this comment.
+1
LGTM, appreciate your solid contribution, keep up the excellent work
Thanks for your contribution! This is a solid addition to the project, and your attention to detail really shows. Contributors like you are what keep this community moving forward. Feel free to keep the PRs coming — we're always glad to have you here!
Please ignore the following message if you have joined in the Slack~
To facilitate focused communication among contributors, we’ve created a brand-new dedicated #contributors channel in official Slack workspace.
Slack workspace link: https://s.apache.org/seatunnel-slack
This channel is designed for technical discussions, feature design brainstorming, roadmap sync and direct communication with project core Contributors. Everyone who contributes code, docs, test cases or community ideas is warmly invited to join, share thoughts and collaborate together under The Apache Way. Welcome to join 😄
Follow-up to #12874, as discussed there with @SEZ9 and @DanielLeens. Opened separately now that the test-side exclusion is on
dev.Purpose of this pull request
numeric_special_value_as_null(#12792) only applies to reading PostgreSQL numeric special values, and onlyJdbcSourceFactorydeclares it. It was defined inJdbcCommonOptions, soJdbcSinkOptionsinherits it too, andJdbcOptionRuleCompletenessTesthad to exclude it from the sink check (NOT_SINK_OPTIONS).This PR defines the option where it applies:
NUMERIC_SPECIAL_VALUE_AS_NULLfromJdbcCommonOptionstoJdbcSourceOptions. The key, type, default (false) and description are unchanged.JdbcConnectionConfig(field default,of(), builder default) atJdbcSourceOptions.JdbcSourceFactoryalready declares it asJdbcSourceOptions.NUMERIC_SPECIAL_VALUE_AS_NULL, which now resolves to the same field directly.NOT_SINK_OPTIONSexclusion fromJdbcOptionRuleCompletenessTest. The sink check passes without it because the sink options no longer see the key.testNumericSpecialValueAsNullIsSourceOnly, which checks that the source accepts the key and the sink rejects it.Impact checked:
NUMERIC_SPECIAL_VALUE_AS_NULLis only referenced insideconnector-jdbc. No other connector, CDC module, engine or core module uses it.*IncrementalSourceOptionsclasses extendorg.apache.seatunnel.connectors.cdc.base.option.JdbcSourceOptions, a different class, so they neither had nor gain the option.Does this PR introduce any user-facing change?
No. The option key, type, default and behaviour are the same, and the sink still rejects the key in
--check/--dry-run.How was this patch tested?
On JDK 17 against
deveceeb0a:./mvnw -pl seatunnel-connectors-v2/connector-jdbc test: 1155 tests, 0 failures, 0 errors (6 skipped), includingJdbcOptionRuleCompletenessTest(3 tests) with the exclusion removed../mvnw -pl seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres,seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql -am install -DskipTests: builds.Check list
New License Guide
incompatible-changes.mdto describe the incompatibility caused by this PR. (not needed)