Repository: spark
Updated Branches:
  refs/heads/master ff5676b01 -> 4d57981cf


[SPARK-19236][CORE] Added createOrReplaceGlobalTempView method

## What changes were proposed in this pull request?

Added the createOrReplaceGlobalTempView method for dataset

Author: Arman <arman.yazdani...@gmail.com>

Closes #16598 from arman1371/patch-1.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4d57981c
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4d57981c
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4d57981c

Branch: refs/heads/master
Commit: 4d57981cfb18e7500cde6c03ae46c7c9b697d064
Parents: ff5676b
Author: Arman <arman.yazdani...@gmail.com>
Authored: Tue May 30 11:09:21 2017 -0700
Committer: Xiao Li <gatorsm...@gmail.com>
Committed: Tue May 30 11:09:21 2017 -0700

----------------------------------------------------------------------
 .../main/scala/org/apache/spark/sql/Dataset.scala    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/4d57981c/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
index 0e74158..b98a705 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
@@ -2747,6 +2747,21 @@ class Dataset[T] private[sql](
   def createGlobalTempView(viewName: String): Unit = withPlan {
     createTempViewCommand(viewName, replace = false, global = true)
   }
+    
+  /**
+   * Creates or replaces a global temporary view using the given name. The 
lifetime of this
+   * temporary view is tied to this Spark application.
+   *
+   * Global temporary view is cross-session. Its lifetime is the lifetime of 
the Spark application,
+   * i.e. it will be automatically dropped when the application terminates. 
It's tied to a system
+   * preserved database `_global_temp`, and we must use the qualified name to 
refer a global temp
+   * view, e.g. `SELECT * FROM _global_temp.view1`.
+   *
+   * @group basic
+   */
+  def createOrReplaceGlobalTempView(viewName: String): Unit = withPlan {
+    createTempViewCommand(viewName, replace = true, global = true)
+  }
 
   private def createTempViewCommand(
       viewName: String,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to