lamber-ken edited a comment on issue #8583: [FLINK-11820][serialization] 
SimpleStringSchema handle message record which value is null
URL: https://github.com/apache/flink/pull/8583#issuecomment-499957988
 
 
   hi, thanks for your commnet @aljoscha. here is detail stackstrace
   ```
   Caused by: java.lang.NullPointerException
        at java.lang.String.<init>(String.java:515)
        at 
org.apache.flink.api.common.serialization.SimpleStringSchema.deserialize(SimpleStringSchema.java:75)
        at 
org.apache.flink.api.common.serialization.SimpleStringSchema.deserialize(SimpleStringSchema.java:36)
        at 
org.apache.flink.streaming.util.serialization.KeyedDeserializationSchemaWrapper.deserialize(KeyedDeserializationSchemaWrapper.java:44)
        at 
org.apache.flink.streaming.connectors.kafka.internal.Kafka09Fetcher.runFetchLoop(Kafka09Fetcher.java:142)
        at 
org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumerBase.run(FlinkKafkaConsumerBase.java:738)
        at 
org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:94)
        at 
org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:58)
        at 
org.apache.flink.streaming.runtime.tasks.SourceStreamTask.run(SourceStreamTask.java:99)
        at 
org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:300)
        at org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)
        at java.lang.Thread.run(Thread.java:748)
   ``` 
   
   <hr>
   
   #### A kafka demo example
   ```
   import org.apache.flink.api.common.serialization.SimpleStringSchema;
   import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
   import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010;
   import java.util.Properties;
   
   public class KafkaTest {
   
       public static void main(String[] args) throws Exception {
   
           StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
   
           Properties p = new Properties();
           p.setProperty("bootstrap.servers", "kmaster.bigdata.ly:9092");
           p.setProperty("group.id", "aan");
   
           FlinkKafkaConsumer010<String> consumer = new 
FlinkKafkaConsumer010("RTC_PROJECT_LOG_T_T_null", new SimpleStringSchema(), p);
           env.addSource(consumer).print();
   
           env.execute();
       }
   
   }
   ```
   
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to