小编Sof*_*ker的帖子

从Apache SQL Spark中删除临时表

registertemptable在下面Apache Spark使用Zeppelin:

val hvacText = sc.textFile("...")

case class Hvac(date: String, time: String, targettemp: Integer, actualtemp: Integer, buildingID: String)

val hvac = hvacText.map(s => s.split(",")).filter(s => s(0) != "Date").map(
    s => Hvac(s(0), 
            s(1),
            s(2).toInt,
            s(3).toInt,
            s(6))).toDF()

hvac.registerTempTable("hvac")
Run Code Online (Sandbox Code Playgroud)

使用此临时表完成查询后,如何删除它?

我检查了所有文档,似乎我无处可去.

任何指导?

scala apache-spark apache-spark-sql apache-zeppelin

18
推荐指数
3
解决办法
3万
查看次数

如何在Zeppelin上的Apache Spark中停止StreamingContext

import org.apache.spark.streaming.{Seconds, StreamingContext}
import org.apache.spark.streaming.eventhubs.EventHubsUtils
import sqlContext.implicits._

val ehParams = Map[String, String](
    "eventhubs.policyname" -> "Full",
...
)

val ssc = new StreamingContext(sc, Seconds(2))
val stream = EventHubsUtils.createUnionStream(ssc, ehParams)
val cr = stream.window(Seconds(6))

case class Message(msg: String)
stream.map(msg=>Message(new String(msg))).foreachRDD(rdd=>rdd.toDF().registerTempTable("temp"))

stream.print
ssc.start
Run Code Online (Sandbox Code Playgroud)

以上这个开始并运行良好,但我似乎无法阻止它.对%sql show tables的任何调用都将冻结.

我如何停止上面的StreamingContext?

apache-spark apache-zeppelin

4
推荐指数
1
解决办法
2659
查看次数