nzw921rx opened a new pull request, #11157:
URL: https://github.com/apache/seatunnel/pull/11157

   ## Purpose of this pull request
   
   Related #11007
   
   1. Migrate 4 imperative `if/throw` checks in 
`KafkaSourceConfig.createConsumerMetadata()` to declarative `Conditions` in 
`KafkaSourceFactory.optionRule()`
   2. Add `greaterOrEqual(START_MODE_TIMESTAMP, 0L)` constraint when 
`start_mode = TIMESTAMP`
   3. Add `greaterOrEqual(START_MODE_END_TIMESTAMP, 0L)` optional value 
constraint
   4. Add `mapNotEmpty(START_MODE_OFFSETS)` constraint when `start_mode = 
SPECIFIC_OFFSETS`
   5. Replace `KEY_PARTITION_DISCOVERY_INTERVAL_MILLIS` conditional-required 
with `greaterThan(..., 0L)` value constraint when `ignore_no_leader_partition = 
true`
   6. Retain runtime-only checks (`> currentTimestamp`) with explanatory 
comments
   
   ## Does this PR introduce _any_ user-facing change?
   
   Yes — previously invalid configurations (negative timestamps, empty offsets 
map) were rejected at task execution time with generic 
`IllegalArgumentException`. Now they are rejected earlier at job submission 
time with structured `OptionValidationException` including option name, 
constraint type, and violation details.
   
   ## How was this patch tested?
   
   Unit tests in `KafkaFactoryTest`:
   
   - `testValidTimestampConfig` — valid TIMESTAMP mode passes validation
   - `testNegativeTimestampRejected` — negative `start_mode.timestamp` is 
rejected
   - `testNegativeEndTimestampRejected` — negative `start_mode.end_timestamp` 
is rejected
   - `testValidSpecificOffsetsConfig` — valid SPECIFIC_OFFSETS mode passes 
validation
   - `testEmptyOffsetsMapRejected` — empty offsets map is rejected
   
   ```bash
   ./mvnw test -pl seatunnel-connectors-v2/connector-kafka 
-Dtest="KafkaFactoryTest" -DfailIfNoTests=false


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