Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13511

Add support for different unix precisions in TimestampConverter SMT

    XMLWordPrintableJSON

Details

    Description

      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 :

      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.

      "transforms": "TimestampConverter",
      "transforms.TimestampConverter.type": "org.apache.kafka.connect.transforms.TimestampConverter$Value",
      "transforms.TimestampConverter.field": "event_date",
      "transforms.TimestampConverter.epoch.precision": "micros",
      "transforms.TimestampConverter.target.type": "Timestamp"
      

      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"

      Attachments

        Activity

          People

            Twobeeb Julien Chanaud
            Twobeeb Julien Chanaud
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: