Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/14897#discussion_r80281859
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala ---
@@ -19,13 +19,46 @@ package org.apache.spark.sql.execution.command
import scala.util.control.NonFatal
-import org.apache.spark.sql.{AnalysisException, Row, SparkSession}
+import org.apache.spark.sql.{AnalysisException, Dataset, Row, SparkSession}
import org.apache.spark.sql.catalyst.{SQLBuilder, TableIdentifier}
import org.apache.spark.sql.catalyst.catalog.{CatalogStorageFormat,
CatalogTable, CatalogTableType}
import org.apache.spark.sql.catalyst.expressions.Alias
import org.apache.spark.sql.catalyst.plans.QueryPlan
import org.apache.spark.sql.catalyst.plans.logical.{LogicalPlan, Project}
-import org.apache.spark.sql.types.StructType
+import org.apache.spark.sql.execution.datasources.{DataSource,
LogicalRelation}
+import org.apache.spark.sql.types.{MetadataBuilder, StructType}
+
+
+/**
+ * ViewType is used to specify the expected view type when we want to
create or replace a view in
+ * [[CreateViewCommand]].
+ */
+sealed trait ViewType
+
+/**
+ * LocalTempView means session-scoped local temporary views. Its lifetime
is the lifetime of the
+ * session that created it, i.e. it will be automatically dropped when the
session terminates. It's
+ * not tied to any databases, i.e. we can't use `db1.view1` to reference a
local temporary view.
+ */
+object LocalTempView extends ViewType
+
+/**
+ * GlobalTempView means cross-session global temporary views. 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.
+ */
+object GlobalTempView extends ViewType
+
+/**
+ * PermanentView means cross-session permanent views. Permanent views stay
until they are
+ * explicitly dropped by user command. It's always tied to a database,
default to the current
+ * database if not specified.
+ *
+ * Note that, Existing permanent view with the same name are not visible
to the current session
+ * while the local temporary view exists, unless the view name is
qualified by database.
+ */
+object PermanentView extends ViewType
--- End diff --
Is `PersistedView` a more conventional name?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]