tombentley commented on a change in pull request #11575: URL: https://github.com/apache/kafka/pull/11575#discussion_r808304776
########## File path: connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java ########## @@ -65,14 +66,22 @@ public static final String FORMAT_CONFIG = "format"; private static final String FORMAT_DEFAULT = ""; + public static final String UNIX_PRECISION_CONFIG = "unix.precision"; + private static final String UNIX_PRECISION_DEFAULT = "milliseconds"; + public static final ConfigDef CONFIG_DEF = new ConfigDef() .define(FIELD_CONFIG, ConfigDef.Type.STRING, FIELD_DEFAULT, ConfigDef.Importance.HIGH, "The field containing the timestamp, or empty if the entire value is a timestamp") .define(TARGET_TYPE_CONFIG, ConfigDef.Type.STRING, ConfigDef.Importance.HIGH, "The desired timestamp representation: string, unix, Date, Time, or Timestamp") .define(FORMAT_CONFIG, ConfigDef.Type.STRING, FORMAT_DEFAULT, ConfigDef.Importance.MEDIUM, "A SimpleDateFormat-compatible format for the timestamp. Used to generate the output when type=string " - + "or used to parse the input if the input is a string."); + + "or used to parse the input if the input is a string.") + .define(UNIX_PRECISION_CONFIG, ConfigDef.Type.STRING, UNIX_PRECISION_DEFAULT, ConfigDef.Importance.LOW, Review comment: There's an overload of `define()` that takes a validator, which should mean you don't need to validate the value yourself and also ensure the valid values are documented; ```suggestion .define(UNIX_PRECISION_CONFIG, ConfigDef.Type.STRING, UNIX_PRECISION_DEFAULT, ConfigDef.ValidString.in( UNIX_PRECISION_NANOS, UNIX_PRECISION_MICROS, UNIX_PRECISION_MILLIS, UNIX_PRECISION_SECONDS), ConfigDef.Importance.LOW, ``` ########## File path: connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java ########## @@ -65,14 +66,22 @@ public static final String FORMAT_CONFIG = "format"; private static final String FORMAT_DEFAULT = ""; + public static final String UNIX_PRECISION_CONFIG = "unix.precision"; + private static final String UNIX_PRECISION_DEFAULT = "milliseconds"; + public static final ConfigDef CONFIG_DEF = new ConfigDef() .define(FIELD_CONFIG, ConfigDef.Type.STRING, FIELD_DEFAULT, ConfigDef.Importance.HIGH, "The field containing the timestamp, or empty if the entire value is a timestamp") .define(TARGET_TYPE_CONFIG, ConfigDef.Type.STRING, ConfigDef.Importance.HIGH, "The desired timestamp representation: string, unix, Date, Time, or Timestamp") .define(FORMAT_CONFIG, ConfigDef.Type.STRING, FORMAT_DEFAULT, ConfigDef.Importance.MEDIUM, "A SimpleDateFormat-compatible format for the timestamp. Used to generate the output when type=string " - + "or used to parse the input if the input is a string."); + + "or used to parse the input if the input is a string.") + .define(UNIX_PRECISION_CONFIG, ConfigDef.Type.STRING, UNIX_PRECISION_DEFAULT, ConfigDef.Importance.LOW, + "The desired unix precision for the timestamp. Used to generate the output when type=unix " + + "or used to parse the input if the input is a Long." + + "Note: This SMT will cause precision loss during conversions from and to values with sub-milliseconds components."); Review comment: ```suggestion "Note: This SMT will cause precision loss during conversions from, and to, values with sub-millisecond components."); ``` ########## File path: connect/transforms/src/main/java/org/apache/kafka/connect/transforms/TimestampConverter.java ########## @@ -65,14 +66,22 @@ public static final String FORMAT_CONFIG = "format"; private static final String FORMAT_DEFAULT = ""; + public static final String UNIX_PRECISION_CONFIG = "unix.precision"; + private static final String UNIX_PRECISION_DEFAULT = "milliseconds"; + public static final ConfigDef CONFIG_DEF = new ConfigDef() .define(FIELD_CONFIG, ConfigDef.Type.STRING, FIELD_DEFAULT, ConfigDef.Importance.HIGH, "The field containing the timestamp, or empty if the entire value is a timestamp") .define(TARGET_TYPE_CONFIG, ConfigDef.Type.STRING, ConfigDef.Importance.HIGH, "The desired timestamp representation: string, unix, Date, Time, or Timestamp") .define(FORMAT_CONFIG, ConfigDef.Type.STRING, FORMAT_DEFAULT, ConfigDef.Importance.MEDIUM, "A SimpleDateFormat-compatible format for the timestamp. Used to generate the output when type=string " - + "or used to parse the input if the input is a string."); + + "or used to parse the input if the input is a string.") + .define(UNIX_PRECISION_CONFIG, ConfigDef.Type.STRING, UNIX_PRECISION_DEFAULT, ConfigDef.Importance.LOW, + "The desired unix precision for the timestamp. Used to generate the output when type=unix " + Review comment: ```suggestion "The desired Unix precision for the timestamp. Used to generate the output when type=unix " + ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org