loserwang1024 commented on code in PR #250:
URL: 
https://github.com/apache/flink-connector-kafka/pull/250#discussion_r3233802642


##########
flink-connector-kafka/pom.xml:
##########
@@ -83,6 +83,12 @@ under the License.
                        <artifactId>flink-runtime</artifactId>
                        <scope>provided</scope>
                </dependency>
+               <dependency>
+                       <groupId>org.apache.flink</groupId>
+                       <artifactId>flink-state-processor-api</artifactId>

Review Comment:
   why need flink-state-processor-api here?



##########
flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/GetKafkaSourceOffsetsTableFunction.java:
##########
@@ -0,0 +1,157 @@
+/*
+ * 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.flink.streaming.connectors.kafka.table;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.ExecutionConfig;
+import org.apache.flink.api.common.state.ListState;
+import org.apache.flink.api.common.state.ListStateDescriptor;
+import org.apache.flink.api.common.typeinfo.Types;
+import org.apache.flink.connector.kafka.source.split.KafkaPartitionSplit;
+import 
org.apache.flink.connector.kafka.source.split.KafkaPartitionSplitSerializer;
+import org.apache.flink.core.fs.CloseableRegistry;
+import org.apache.flink.core.memory.DataInputViewStreamWrapper;
+import org.apache.flink.runtime.checkpoint.OperatorState;
+import org.apache.flink.runtime.checkpoint.OperatorSubtaskState;
+import org.apache.flink.runtime.checkpoint.metadata.CheckpointMetadata;
+import org.apache.flink.runtime.state.DefaultOperatorStateBackend;
+import org.apache.flink.runtime.state.DefaultOperatorStateBackendBuilder;
+import org.apache.flink.runtime.state.OperatorStateHandle;
+import org.apache.flink.state.api.OperatorIdentifier;
+import org.apache.flink.state.api.runtime.SavepointLoader;
+import org.apache.flink.table.annotation.DataTypeHint;
+import org.apache.flink.table.annotation.FunctionHint;
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.functions.BuiltInFunctionDefinition;
+import org.apache.flink.table.functions.SpecializedFunction;
+import org.apache.flink.table.functions.TableFunction;
+import org.apache.flink.table.types.inference.TypeStrategies;
+import org.apache.flink.types.Row;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.StreamSupport;
+
+import static org.apache.flink.table.functions.FunctionKind.TABLE;
+
+/**
+ * Table function to extract Kafka source offsets from savepoints.
+ *
+ * <p>This function reads Kafka partition splits from a savepoint and extracts 
the offset
+ * information for each partition. The function is designed to work with the 
Flink state processing
+ * API and provides visibility into the Kafka source state.
+ */
+@Internal
+@FunctionHint(
+        output =
+                @DataTypeHint(
+                        "ROW<topic STRING NOT NULL, "
+                                + "partition INT NOT NULL, "
+                                + "starting-offset BIGINT NOT NULL, "
+                                + "stopping-offset BIGINT NULL>"))
+public class GetKafkaSourceOffsetsTableFunction extends TableFunction<Row> {

Review Comment:
   I don't think using savepoint_get_kafka_offsets here is a good idea. 
   1. How would Flink even know this function originates from a Kafka 
connector? This approach would require placing the JAR into the lib directory, 
but what if other JARs contain the same method? That could lead to conflicts or 
unpredictable behavior. 
   2. Also, isn't the method name savepoint_get_kafka_offsets itself 
problematic? I thinks `get_kafka_offsets_from_savepoint` would be better. 
   
   @leonardBang , CC, WDYT?



##########
pom.xml:
##########
@@ -53,7 +53,7 @@ under the License.
 
                <!-- Main Dependencies -->
                <confluent.version>7.9.2</confluent.version>
-               <flink.version>2.1.0</flink.version>
+               <flink.version>2.2.1</flink.version>

Review Comment:
   Maybe do it in a seperate PR to trace the flink version change.



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