{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/14897","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/14897/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/14897/comments","events_url":"https://api.github.com/repos/apache/spark/issues/14897/events","html_url":"https://github.com/apache/spark/pull/14897","id":174293868,"number":14897,"title":"[SPARK-17338][SQL] add global temp view","user":{"login":"cloud-fan","id":3182036,"avatar_url":"https://avatars.githubusercontent.com/u/3182036?v=3","gravatar_id":"","url":"https://api.github.com/users/cloud-fan","html_url":"https://github.com/cloud-fan","followers_url":"https://api.github.com/users/cloud-fan/followers","following_url":"https://api.github.com/users/cloud-fan/following{/other_user}","gists_url":"https://api.github.com/users/cloud-fan/gists{/gist_id}","starred_url":"https://api.github.com/users/cloud-fan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloud-fan/subscriptions","organizations_url":"https://api.github.com/users/cloud-fan/orgs","repos_url":"https://api.github.com/users/cloud-fan/repos","events_url":"https://api.github.com/users/cloud-fan/events{/privacy}","received_events_url":"https://api.github.com/users/cloud-fan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":26,"created_at":"2016-08-31T14:49:29Z","updated_at":"2016-09-27T16:12:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/14897","html_url":"https://github.com/apache/spark/pull/14897","diff_url":"https://github.com/apache/spark/pull/14897.diff","patch_url":"https://github.com/apache/spark/pull/14897.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nGlobal temporary view is a cross-session temporary view, which means it's shared among all sessions. 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`(configurable via SparkConf), and we must use the qualified name to refer a global temp view, e.g. SELECT * FROM global_temp.view1.\r\n\r\nchanges for `SessionCatalog`:\r\n\r\n1. add a new field `gloabalTempViews: GlobalTempViewManager`, to access the shared global temp views, and a new field `globalTempDB: String`, to indicate the global temp db name.\r\n2. `createDatabase` will fail if users wanna create `global_temp`, which is system preserved.\r\n3. `setCurrentDatabase` will fail if users wanna set `global_temp`, which is system preserved.\r\n4. add `createGlobalTempView`, which is used in `CreateViewCommand` to create global temp views.\r\n5. add `dropGlobalTempView`, which is used in `CatalogImpl` to drop global temp view.\r\n6. add `alterTempViewDefinition`, which is used in `AlterViewAsCommand` to update the view definition for local/global temp views.\r\n7. `renameTable`/`dropTable`/`isTemporaryTable`/`lookupRelation`/`getTempViewOrPermanentTableMetadata`/`refreshTable` will handle global temp views.\r\n\r\nchanges for SQL commands:\r\n\r\n1. `CreateViewCommand`/`AlterViewAsCommand` is updated to support global temp views\r\n2. `ShowTablesCommand` outputs a new column `database`, which is used to distinguish global and local temp views.\r\n3. other commands can also handle global temp views if they call `SessionCatalog` APIs which accepts global temp views, e.g. `DropTableCommand`, `AlterTableRenameCommand`, `ShowColumnsCommand`, etc.\r\n\r\nchanges for other public API\r\n\r\n1. add a new method `dropGlobalTempView` in `Catalog`\r\n2. add a new method `createGlobalTempView` in `Dataset`\r\n\r\n## How was this patch tested?\r\n\r\nnew tests in `SQLViewSuite`"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/249914504","html_url":"https://github.com/apache/spark/pull/14897#issuecomment-249914504","issue_url":"https://api.github.com/repos/apache/spark/issues/14897","id":249914504,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars.githubusercontent.com/u/8108735?v=3","gravatar_id":"","url":"https://api.github.com/users/SparkQA","html_url":"https://github.com/SparkQA","followers_url":"https://api.github.com/users/SparkQA/followers","following_url":"https://api.github.com/users/SparkQA/following{/other_user}","gists_url":"https://api.github.com/users/SparkQA/gists{/gist_id}","starred_url":"https://api.github.com/users/SparkQA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparkQA/subscriptions","organizations_url":"https://api.github.com/users/SparkQA/orgs","repos_url":"https://api.github.com/users/SparkQA/repos","events_url":"https://api.github.com/users/SparkQA/events{/privacy}","received_events_url":"https://api.github.com/users/SparkQA/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T16:12:31Z","updated_at":"2016-09-27T16:12:31Z","body":"**[Test build #65985 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/65985/consoleFull)** for PR 14897 at commit [`6183400`](https://github.com/apache/spark/commit/6183400275837f51a84b6259e7aa5e011d77c2ea)."}}
{"actor":{"display_login":"SparkQA"}}