PatrickRen commented on a change in pull request #17601:
URL: https://github.com/apache/flink/pull/17601#discussion_r739070733



##########
File path: 
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/table/KafkaDynamicTableFactoryTest.java
##########
@@ -380,6 +381,44 @@ public void testTableSourceCommitOnCheckpointDisabled() {
                                 .noDefaultValue()));
     }
 
+    @Test
+    public void testTableSourceSetOffsetReset() {

Review comment:
       NIT: We can use parameterized test here after migrating to JUnit 5 😄 

##########
File path: 
flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/KafkaDynamicSource.java
##########
@@ -392,7 +394,15 @@ public int hashCode() {
                 
kafkaSourceBuilder.setStartingOffsets(OffsetsInitializer.latest());
                 break;
             case GROUP_OFFSETS:
-                
kafkaSourceBuilder.setStartingOffsets(OffsetsInitializer.committedOffsets());
+                String offsetResetConfig =
+                        
properties.getProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG);
+                if (offsetResetConfig == null) {
+                    
kafkaSourceBuilder.setStartingOffsets(OffsetsInitializer.committedOffsets());
+                } else {
+                    kafkaSourceBuilder.setStartingOffsets(
+                            OffsetsInitializer.committedOffsets(
+                                    
getOffsetResetStrategy(offsetResetConfig)));

Review comment:
       What about using 
`OffsetResetStrategy.valueOf(offsetResetConfig.toUpperCase(Locale.ROOT))` ?




-- 
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: [email protected]

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


Reply via email to