KAFKA-13511: Add support for different unix precisions in TimestampConverter SMT#11575
KAFKA-13511: Add support for different unix precisions in TimestampConverter SMT#11575mimaison merged 14 commits intoapache:trunkfrom
Conversation
|
@mimaison @rhauch before considering going further with this PR, any chance I could to get your opinion on this subject ? The main idea behind this PR is that Avro logical types are not fully supported in Kafka Connect but even if they were, it would not help schema-less messages that need to convert epoch with a precision different than ms. For this reason, I consider this would be an interesting addition. |
e028c1e to
b616bc8
Compare
|
Hi @twobeeb, thanks for the PR, this looks like a useful addition. However as this is adding a new configuration, this change requires a KIP before we can accept it. |
|
Sorry @twobeeb, I'll try to take a look this afternoon. Thanks |
|
Hi everyone, |
connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java
Outdated
Show resolved
Hide resolved
connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java
Outdated
Show resolved
Hide resolved
connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Tom Bentley <tombentley@users.noreply.github.com>
|
@tombentley |
mimaison
left a comment
There was a problem hiding this comment.
Thanks @twobeeb for the PR. It looks good, I just left a minor comment.
connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java
Outdated
Show resolved
Hide resolved
Yes feel free to address it in this PR if you want. |
connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java
Outdated
Show resolved
Hide resolved
* apache-kafka/trunk: (49 commits) KAFKA-12738: send LeaveGroup request when thread dies to optimize replacement time (apache#11801) MINOR: Skip fsync on parent directory to start Kafka on ZOS (apache#11793) KAFKA-12738: track processing errors and implement constant-time task backoff (apache#11787) MINOR: Cleanup admin creation logic in integration tests (apache#11790) KAFKA-10199: Add interface for state updater (apache#11499) KAFKA-10000: Utils methods for overriding user-supplied properties and dealing with Enum types (apache#11774) KAFKA-10000: Add new metrics for source task transactions (apache#11772) KAFKA-13676: Commit successfully processed tasks on error (apache#11791) KAFKA-13511: Add support for different unix precisions in TimestampConverter SMT (apache#11575) MINOR: Improve Connect docs (apache#11642) ...
Currently, the SMT TimestampConverter can convert Timestamp from either source String, Long or Date into target String, Long or Date.
The problem is that Long source or target is required to be epoch in milliseconds.
In many cases, epoch is represented with different precisions. This leads to several Jira tickets :
KAFKA-12364: add support for date from int32 to timestampconverter
KAFKA-10561: Support microseconds precision for Timestamps
I propose to add a new config to TimestampConverter called "epoch.precision" which defaults to "millis" so as to not impact existing code, and allows for more precisions : seconds, millis, micros.
Exactly like "format" field which is used as input when the source in String and output when the target.type is string, this new field would be used as input when the field is Long, and as output when the target.type is "unix"
Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.
Committer Checklist (excluded from commit message)