You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Greg Harris (Jira)" <ji...@apache.org> on 2023/02/02 16:37:00 UTC

[jira] [Updated] (KAFKA-14671) Refactor PredicatedTransformation to not implement Transformation

     [ https://issues.apache.org/jira/browse/KAFKA-14671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Harris updated KAFKA-14671:
--------------------------------
    Description: 
The PredicatedTransformation [https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/PredicatedTransformation.java] 
is an instance of Transformation, a plugin class.
This allows both a PredicatedTransformation and a base Transformation to exist in the same list inside of the TransformationChain.

However, the PredicatedTransformation is not a compliant general-purpose Transformation, and has a number of non-standard behaviors:
1. The PredicatedTransformation is hidden from the REST API plugin listings
2. PredicatedTransformation::config and ::configure throw an exception, as they are not called under normal circumstances
3. The PredicatedTransformation has no default constructor, and would throw an exception if loaded via the standard plugin initialization logic.
4. The TransformationChain calls `.getClass()` on the PredicatedTransformation, which returns the PredicatedTransformation class itself, and not the wrapped transformation class.

 

The current implementation is also an exceptional case and would conflict with potential future changes:
1. If the "Versioned" interface were added to SMTs, the PredicatedTransformation would throw exceptions during plugin scanning
2. If the `connect-plugin-path.sh` script is implement as-described in KIP-898, the PredicatedTransformation would show up as a non-migrated plugin class
3. If https://issues.apache.org/jira/browse/KAFKA-14670 is implemented, then there will be no common interface for wrapped transformations and PredicatedTransformations to exist in the same data structure.

The PredicatedTransformation is a reasonable abstraction to compose a predicate and transformation, but it can do so without subclassing Transformation, and incurring the above pitfalls.

  was:
The PredicatedTransformation [https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/PredicatedTransformation.java] 
is an instance of Transformation, a plugin class.
This allows both a PredicatedTransformation and a base Transformation to exist in the same list inside of the TransformationChain.

However, the PredicatedTransformation is not a compliant general-purpose Transformation, and has a number of non-standard behaviors:
1. The PredicatedTransformation is hidden from the REST API plugin listings
2. PredicatedTransformation::config and ::configure throw an exception, as they are not called under normal circumstances
3. The PredicatedTransformation has no default constructor, and would throw an exception if loaded via the standard plugin initialization logic.
4. The TransformationChain calls `.getClass()` on the PredicatedTransformation, which returns the PredicatedTransformation class itself, and not the wrapped transformation class.

The PredicatedTransformation is a reasonable abstraction to compose a predicate and transformation, but it can do so without subclassing Transformation, and incurring the above pitfalls.


> Refactor PredicatedTransformation to not implement Transformation
> -----------------------------------------------------------------
>
>                 Key: KAFKA-14671
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14671
>             Project: Kafka
>          Issue Type: Task
>          Components: KafkaConnect
>    Affects Versions: 3.5.0
>            Reporter: Greg Harris
>            Assignee: Greg Harris
>            Priority: Minor
>
> The PredicatedTransformation [https://github.com/apache/kafka/blob/trunk/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/PredicatedTransformation.java] 
> is an instance of Transformation, a plugin class.
> This allows both a PredicatedTransformation and a base Transformation to exist in the same list inside of the TransformationChain.
> However, the PredicatedTransformation is not a compliant general-purpose Transformation, and has a number of non-standard behaviors:
> 1. The PredicatedTransformation is hidden from the REST API plugin listings
> 2. PredicatedTransformation::config and ::configure throw an exception, as they are not called under normal circumstances
> 3. The PredicatedTransformation has no default constructor, and would throw an exception if loaded via the standard plugin initialization logic.
> 4. The TransformationChain calls `.getClass()` on the PredicatedTransformation, which returns the PredicatedTransformation class itself, and not the wrapped transformation class.
>  
> The current implementation is also an exceptional case and would conflict with potential future changes:
> 1. If the "Versioned" interface were added to SMTs, the PredicatedTransformation would throw exceptions during plugin scanning
> 2. If the `connect-plugin-path.sh` script is implement as-described in KIP-898, the PredicatedTransformation would show up as a non-migrated plugin class
> 3. If https://issues.apache.org/jira/browse/KAFKA-14670 is implemented, then there will be no common interface for wrapped transformations and PredicatedTransformations to exist in the same data structure.
> The PredicatedTransformation is a reasonable abstraction to compose a predicate and transformation, but it can do so without subclassing Transformation, and incurring the above pitfalls.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)