nzw921rx opened a new issue, #12780:
URL: https://github.com/apache/seatunnel/issues/12780

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/seatunnel/issues) 
and found a related
     report for the `Filter` transform (same root cause, listed below).
   
   ### SeaTunnel Version
   
   dev (any version that contains #11095)
   
   ### Minimal Reproduction
   
   `CopyFieldTransformFactory` and `FilterRowKindTransformFactory` (like 
`FilterFieldTransformFactory`)
   declare a `table_transform`-capable transform whose options are an 
**exclusive required** group:
   
   ```java
   // CopyFieldTransformFactory
   .exclusive(CopyTransformConfig.FIELDS, CopyTransformConfig.SRC_FIELD)
   ...
   .optional(TransformCommonOptions.MULTI_TABLES)
   
   // FilterRowKindTransformFactory
   .exclusive(
           FilterRowKinkTransformConfig.INCLUDE_KINDS,
           FilterRowKinkTransformConfig.EXCLUDE_KINDS)
   ...
   .optional(TransformCommonOptions.MULTI_TABLES)
   ```
   
   `OptionRule.Builder#exclusive(...)` maps to 
`RequiredOption.ExclusiveRequiredOptions`, and
   `ConfigValidator#checkExclusive` rejects the configuration when none of the 
group is set
   ("exactly one option must be set, but none are configured").
   
   That contradicts the documented multi-table usage, where the per-table rules 
live in
   `table_transform` entries and the transform level intentionally sets neither 
option:
   
   ```hocon
   transform {
     Copy {
       plugin_input = "fake"
       plugin_output = "fake1"
       table_transform = [{
         table_path = "test.xyz"
         src_field = "name"
         dest_field = "name2"
       }]
     }
   }
   ```
   
   ```hocon
   transform {
     FilterRowKind {
       table_transform = [{
         table_path = "test.xyz"
         include_kinds = [INSERT]
       }]
     }
   }
   ```
   
   ### Expected Behavior
   
   The job starts and the per-table rules from `table_transform` are applied.
   
   ### Actual Behavior
   
   The job fails deterministically before any data is processed, because
   `FactoryUtil#createAndPrepareMultiTableTransform` validates the 
transform-level options with
   `factory.optionRule()`:
   
   ```
   options: 'fields', 'src_field'
         type: exclusive
         constraint: exactly one option must be set, but none are configured
   
   options: 'include_kinds', 'exclude_kinds'
         type: exclusive
         constraint: exactly one option must be set, but none are configured
   ```
   
   ### Additional context
   
   Verified by running `ConfigValidator` against every transform factory that 
declares
   `TransformCommonOptions.MULTI_TABLES` with a `table_transform`-only 
configuration: three factories
   fail with this rule:
   
   | Transform | Exclusive group |
   | --- | --- |
   | `Filter` | `include_fields`, `exclude_fields` (reported separately) |
   | `Copy` | `fields`, `src_field` |
   | `FilterRowKind` | `include_kinds`, `exclude_kinds` |
   
   All three were migrated to `OptionRule` by #11095; before that commit the 
multi-table configuration
   above was accepted.
   
   ### Suggested fix
   
   Make the group optional and reject only "both configured", for example with 
a `ConditionExtension`
   (`Conditions.extension(...)`), or make the rule conditional on 
`table_transform` not being
   configured (`.conditional(...)` / `.conditionalRule(...)`). Keep the "at 
least one of them" check
   for the non-multi-table path inside the transform, where the effective 
per-table config is known.
   Add one regression test per transform that validates the rule with only 
`table_transform`
   configured.
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   


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