THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
New config property for TimestampConverter
Implementation details to be discussed : TimeUnit.MILLISECONDS.toMicros(epochMilis) and so on for the other conversions seems the easiest way.
Code Block | ||
---|---|---|
| ||
"transforms.TimestampConverter.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value", "transforms.TimestampConverter.field": "event_date_long", "transforms.TimestampConverter.epoch.precision": "micros", "transforms.TimestampConverter.target.type": "Timestamp" |
java.util.Date and SimpleDateFormat limitations
Since these classes can only handle precisions down to the millisecond, it should be noted that:
- converting Long microseconds into any target type leads to a precision loss (truncation after millis)
- converting any source type into Long microseconds, the microseconds part will always be 000
int32 and seconds
Systems that produces int32 into Kafka should willingly chain Cast SMT and then TimestampConverter SMT if they want to use this feature.
Code Block | ||
---|---|---|
| ||
"transforms": "Cast,TimestampConverter", "transforms.Cast.type": "org.apache.kafka.connect.transforms.Cast$Value", "transforms.Cast.spec": "event_date_int:int64", "transforms.TimestampConverter.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value", "transforms.TimestampConverter.field": "event_date_int", "transforms.TimestampConverter.epoch.precision": "seconds", "transforms.TimestampConverter.target.type": "Timestamp" |
java.util.Date and SimpleDateFormat limitations
Since these classes can only handle precisions down to the millisecond, it should be stated that:
...
Compatibility, Deprecation, and Migration Plan
...