我对java/scala相当陌生。我在Spark 3 repo中找不到< code>SharedSQLContext。我们一般如何在更新版本中找到类的等价物?我找不到这方面的任何文件。谢谢大家!
现有类示例:
class KafkaDataConsumerSuite extends SharedSQLContext with PrivateMethodTester {
protected var testUtils: KafkaTestUtils = _
override def beforeAll(): Unit = {
super.beforeAll()
testUtils = new KafkaTestUtils(Map[String, Object]())
testUtils.setup()
}
override def afterAll(): Unit = {
if (testUtils != null) {
testUtils.teardown()
testUtils = null
}
super.afterAll()
}
test("SPARK-19886: Report error cause correctly in reportDataLoss") {
val cause = new Exception("D'oh!")
val reportDataLoss = PrivateMethod[Unit]('reportDataLoss0)
val e = intercept[IllegalStateException] {
BlackbirdInternalKafkaConsumer.invokePrivate(reportDataLoss(true, "message", cause))
}
assert(e.getCause === cause)
}
}
在Spark 3中,已删除SharedSQLContext
类和相关API。Spark 2.4 中的 SharedSQLContext
等效项是 SparkSession
对象。
SparkSession
为在Spark中处理结构化数据提供了一个入口点,它封装了以前在SQLContext
和HiveContext
中找到的所有功能。