【发布时间】:2018-01-12 10:08:05
【问题描述】:
我想从kafka读取结构化流数据作为dstream,对于每个数据,我想用很多函数来处理它,所以我尝试缓存dstream。
lines = spark\
.readStream\
.format("kafka")\
.option("kafka.bootstrap.servers", bootstrapServers)\
.option(subscribeType, topics)\
.load()\
.selectExpr("CAST(value AS STRING)")
lines.cache()
...
...
lines.cache()
但是,我得到了如下错误
Queries with streaming sources must be executed with writeStream.start();;
有什么帮助吗?
【问题讨论】:
标签: apache-spark spark-dataframe spark-streaming