Github user liyintang commented on the pull request:
https://github.com/apache/spark/pull/11921#issuecomment-200984928
@koeninger , that example is just for demonstrating the bug. The actual
code I run is more than count :)
I need to convert the kafka message to a dataframe, and run spark sql on it.
```
val functions: (RDD[MessageAndMetadata[String, String]] =>
Unit) = (rdd) => {
val startTS = System.currentTimeMillis()
// filter out null message, otherwise it will cause json
parsing throw exception
val messageRDD = rdd.map(_.message()).filter(_ != null)
val inputDF =
sqlContext.read.schema(sourceStreamObject.schema).json(messageRDD)
inputDF.registerTempTable(sourceStreamObject.name)
inputDF.cache()
processObjects.foreach(_.run(sqlContext))
sinkObjects.foreach(_.sink(sqlContext))
```
But the point is well taken. I agree that it makes more sense to caching on
result instead of raw input.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]