eolivelli commented on a change in pull request #9947:
URL: https://github.com/apache/pulsar/pull/9947#discussion_r596686252



##########
File path: 
pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/AbstractKafkaConnectSource.java
##########
@@ -183,13 +183,16 @@ public void close() {
         Optional<String> partitionId;
         @Getter
         Optional<String> destinationTopic;
+        @Getter
+        Optional<Integer> partitionNumber;
 
         KafkaSchemaWrappedSchema keySchema;
 
         KafkaSchemaWrappedSchema valueSchema;
 
         AbstractKafkaSourceRecord(SourceRecord srcRecord) {
             this.destinationTopic = Optional.of("persistent://"+topicNamespace 
+ "/" + srcRecord.topic());
+            this.partitionNumber = Optional.of(srcRecord.kafkaPartition());

Review comment:
       Optional.ofNullable ?

##########
File path: 
pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/PulsarRecord.java
##########
@@ -61,6 +61,11 @@
         return Optional.of(topicName);
     }
 
+    @Override
+    public Optional<Integer> getPartitionNumber() {
+        return Optional.of(partition);

Review comment:
       Optional.ofNullable ?

##########
File path: 
pulsar-io/kafka/src/main/java/org/apache/pulsar/io/kafka/KafkaAbstractSource.java
##########
@@ -178,6 +178,11 @@ public KafkaRecord(ConsumerRecord<String,?> record, V 
value, Schema<V> schema) {
             return Optional.of(Integer.toString(record.partition()));
         }
 
+        @Override
+        public Optional<Integer> getPartitionNumber() {
+            return Optional.of(record.partition());

Review comment:
       Optional.ofNullable ?




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to