apache-spark - createOrReplaceGlobalTempView 和 createOrReplaceTempView 之间的区别

标签 apache-spark pyspark

我试图了解 createOrReplaceGlobalTempView 和 createOrReplaceTempView 之间的区别。

createOrReplaceTempView是在2.0版本中引入的,createOrReplaceGlobalTempView是在2.2版本中引入的。

根据文档,

对于 createOrReplaceGlobalTempView :此临时 View 的生命周期与此 Spark 应用程序相关联。

对于 createOrReplaceGlobalTempView :此临时表的生命周期与用于创建此 DataFrame 的 SparkSession 相关联。

能否请您详细说明一下 Spark Application 和 SparkSession 的区别。

问候,

尼拉吉

最佳答案

标准临时表位于用户空间中,similarly to Hive

The data in these tables is stored in the user's scratch directory rather than in the Hive warehouse directory. The scratch directory effectively acts as the user' data sandbox.

并且仅限于单个用户 session 。

全局临时 View 的不同之处在于,可以被多个 session 访问,因此在普通 View (可以全局访问,它注册在全局临时数据库中)和临时 View (其范围是仅限于单个 session )。

关于apache-spark - createOrReplaceGlobalTempView 和 createOrReplaceTempView 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48519038/

相关文章:

pyspark - 转换列并更新 DataFrame

apache-spark - 如何在 jupyter notebook 中将 spark 数据帧写入 avro 文件格式?

scala - 从 Spark 数据帧访问特定行

python - 如何将自定义停用词列表添加到 StopWordsRemover

pandas - 使用 Apache Arrow 将 PySpark DataFrame 转换为 Pandas

python - 在 PySpark 中将十进制解码为二进制信息

java - 如何在不删除配置单元表的情况下基于 DataFrame 从 SparkSQL 更改表,如删除/添加列?

java - 解决 Apache Spark 中的依赖问题

apache-spark - Spark 如何向工作线程发送闭包?

python - 如何检查我的一列值是否存在于另一列中