ZihanLi58 commented on a change in pull request #3372:
URL: https://github.com/apache/gobblin/pull/3372#discussion_r695313863



##########
File path: 
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaStreamingExtractor.java
##########
@@ -323,8 +323,10 @@ public KafkaStreamingExtractor(WorkUnitState state) {
   @Override
   public S getSchema() {
     try {
-      Schema schema = (Schema) 
this._schemaRegistry.get().getLatestSchemaByTopic(this.topicPartitions.get(0).getTopicName());
-      return (S) schema;
+      if(this._schemaRegistry.isPresent()) {
+        return (S)(Schema) 
this._schemaRegistry.get().getLatestSchemaByTopic(this.topicPartitions.get(0).getTopicName());
+      }
+      return (S) this.topicPartitions.iterator().next().getTopicName();

Review comment:
       It's because many converter does not accept null in convertSchema() 
method. And simply return null will cause issue there. I just use the same 
behavior as KafkaSimpleStreamingExtractor where if the schema registry is null, 
we just return topic name as schema




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