Current state: Discarded
Discussion thread: here
JIRA: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Today's connect predicates enables checks on the record metadata. However, this can be limiting considering many inbuilt and custom transformations that we have are more key/value-centric.
Some use-cases this can solve:
TimestampConverter
can be run only if the specified date field exists irrespective of the record metadata]InsertField
transform if the field already exists) thereby breaking the task. Giving this control enable users to consciously configure for such cases.New:
This KIP proposes to have a new HasField predicate class that works for records with or without schema.
abc.xyz
). Hence supports nested field checks.predicates.<predicateName>.field.path
created_at
field exists"transforms": "modifyDate", "transforms.modifyDate.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value", "transforms.modifyDate.target.format": "yyyy-MM-dd", "transforms.modifyDate.target.type": "string", "transforms.modifyDate.field": "created_at", "transforms.modifyDate.predicate": "hasCreatedAt", "predicates": "hasCreatedAt", "predicates.hasCreatedAt.type": "org.apache.kafka.connect.transforms.predicates.HasField$Value", "predicates.hasCreatedAt.field.path": "created_at" |
testField
doesn't exist"transforms": "insertTestField", "transforms.insertTestField.type": "org.apache.kafka.connect.transforms.InsertField$Value", "transforms.insertTestField.static.field": "testField", "transforms.insertTestField.static.value": "test val", "transforms.insertTestField.predicate": "hasTestField", "transforms.insertTestField.negate": "true", "predicates": "hasTestField", "predicates.hasTestField.type": "org.apache.kafka.connect.transforms.predicates.HasField$Value", "predicates.hasTestField.field.path": "testField" |
Fully respects the current predicate interfaces and there is no need for deprecation/migration.
field.path
setting is mandatory when the predicate is enabled