Trying to read from kafka source. I want to extract timestamp from message received to do structured spark streaming.kafka(version 0.10.0.0)spark streaming(version 2.0.1) 解决方案 spark.read .format("kafka") .option("kafka.bootstrap.servers", "your.server.com:9092") .option("subscribe", "your-topic") .load() .select($"timestamp", $"value")Field "timestamp" is what you are looking for. Type - java.sql.Timestamp. Make sure that you are connecting to 0.10 Kafka server. There is no timestamp in earlier versions.Full list of fields described here - http://spark.apache.org/docs/latest/structured-streaming-kafka-integration.html#creating-a-kafka-source-for-batch-queries 这篇关于从Spark Streaming中的kafka消息中提取时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!