wangxianghu commented on a change in pull request #2227:
URL: https://github.com/apache/hudi/pull/2227#discussion_r517075987



##########
File path: 
hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/KafkaOffsetGen.java
##########
@@ -156,15 +160,18 @@ public static long totalNewMessages(OffsetRange[] ranges) 
{
   private final HashMap<String, Object> kafkaParams;
   private final TypedProperties props;
   protected final String topicName;
+  private final KafkaResetOffsetStrategies autoResetValue;
 
   public KafkaOffsetGen(TypedProperties props) {
     this.props = props;
+
     kafkaParams = new HashMap<>();
     for (Object prop : props.keySet()) {
       kafkaParams.put(prop.toString(), props.get(prop.toString()));
     }
     DataSourceUtils.checkRequiredProperties(props, 
Collections.singletonList(Config.KAFKA_TOPIC_NAME));
     topicName = props.getString(Config.KAFKA_TOPIC_NAME);
+    autoResetValue = 
KafkaResetOffsetStrategies.valueOf(props.getString("auto.offset.reset", 
Config.DEFAULT_AUTO_RESET_OFFSET.toString()).toUpperCase());

Review comment:
       I suggest check the string value of  `auto.offset.reset` and set default 
value to `LATEST`  if it is not set to `LATEST` or `EARLIEST` before we get the 
`KafkaResetOffsetStrategies`. 
   Because `KafkaResetOffsetStrategies` has only two values: `LATEST` and 
`LATEST`, if the user set it to other value this line will throw an exception.
   
   the lines bellow is useless:
   ````
   default:
               throw new HoodieNotSupportedException("Auto reset value must be 
one of 'earliest' or 'latest' ");
   ````




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to