shangxinli commented on code in PR #18125:
URL: https://github.com/apache/hudi/pull/18125#discussion_r2884965321


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/util/StreamerUtil.java:
##########
@@ -729,4 +733,163 @@ public static void validateWriteStatus(
       });
     }
   }
+
+  /**
+   * Extracts Kafka offset metadata from a Hudi commit.
+   *
+   * @param commitInstant The commit instant to extract metadata from
+   * @param timeline The timeline to read commit details from
+   * @return The Kafka offset metadata string, or null if not found
+   * @throws IOException if error reading commit metadata
+   */
+  public static String extractKafkaOffsetMetadata(final HoodieInstant 
commitInstant,

Review Comment:
   Done. Moved `extractKafkaOffsetMetadata`, `parseKafkaOffsets`, and 
`calculateKafkaOffsetDifference` into a new `KafkaOffsetParseUtils` class along 
with the related constants.



##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/TestStreamerUtil.java:
##########
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.util;
+
+import org.apache.hudi.common.model.HoodieCommitMetadata;
+import org.apache.hudi.common.table.timeline.HoodieInstant;
+import org.apache.hudi.common.table.timeline.HoodieTimeline;
+import org.apache.hudi.common.table.timeline.TimelineUtils;
+
+import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hudi.exception.HoodieException;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests for StreamerUtil Kafka offset methods.
+ */
+public class TestStreamerUtil {

Review Comment:
   Done. Removed the separate test class and merged all Kafka offset tests into 
the existing `TestStreamerUtil` in `org.apache.hudi.utils`.



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