Greg Harris created KAFKA-14671: ----------------------------------- Summary: 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
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. -- This message was sent by Atlassian Jira (v8.20.10#820010)