Skip to content

Commit 4d57981

Browse files
arman1371gatorsmile
authored andcommitted
[SPARK-19236][CORE] Added createOrReplaceGlobalTempView method
## What changes were proposed in this pull request? Added the createOrReplaceGlobalTempView method for dataset Author: Arman <arman.yazdani.10@gmail.com> Closes #16598 from arman1371/patch-1.
1 parent ff5676b commit 4d57981

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,6 +2747,21 @@ class Dataset[T] private[sql](
27472747
def createGlobalTempView(viewName: String): Unit = withPlan {
27482748
createTempViewCommand(viewName, replace = false, global = true)
27492749
}
2750+
2751+
/**
2752+
* Creates or replaces a global temporary view using the given name. The lifetime of this
2753+
* temporary view is tied to this Spark application.
2754+
*
2755+
* Global temporary view is cross-session. Its lifetime is the lifetime of the Spark application,
2756+
* i.e. it will be automatically dropped when the application terminates. It's tied to a system
2757+
* preserved database `_global_temp`, and we must use the qualified name to refer a global temp
2758+
* view, e.g. `SELECT * FROM _global_temp.view1`.
2759+
*
2760+
* @group basic
2761+
*/
2762+
def createOrReplaceGlobalTempView(viewName: String): Unit = withPlan {
2763+
createTempViewCommand(viewName, replace = true, global = true)
2764+
}
27502765

27512766
private def createTempViewCommand(
27522767
viewName: String,

0 commit comments

Comments
 (0)