You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/09/27 08:41:40 UTC

[GitHub] [hudi] yanghua commented on a change in pull request #3715: [HUDI-2487] fix JsonKafkaSource cannot filter empty messages from kafka

yanghua commented on a change in pull request #3715:
URL: https://github.com/apache/hudi/pull/3715#discussion_r716480508



##########
File path: hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/JsonKafkaSource.java
##########
@@ -69,7 +69,14 @@ public JsonKafkaSource(TypedProperties properties, JavaSparkContext sparkContext
 
   private JavaRDD<String> toRDD(OffsetRange[] offsetRanges) {
     return KafkaUtils.createRDD(sparkContext, offsetGen.getKafkaParams(), offsetRanges,
-            LocationStrategies.PreferConsistent()).map(x -> (String) x.value());
+            LocationStrategies.PreferConsistent()).filter(x -> {
+              String msgValue = (String) x.value();
+              //Filter null messages from Kafka to prevent Exceptions
+              if (msgValue == null) {

Review comment:
       `return msgValue != null;`?




-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org