Skip to content

Commit

Permalink
address PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
imback82 committed Apr 9, 2021
1 parent 594981a commit 0ab3653
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,7 @@ case class RepairTable(
case class AlterViewAs(
child: LogicalPlan,
originalText: String,
query: LogicalPlan) extends BinaryCommand {
override def left: LogicalPlan = child
override def right: LogicalPlan = query
}
query: LogicalPlan) extends UnaryCommand

/**
* The logical plan of the ALTER VIEW ... SET TBLPROPERTIES command.
Expand Down
3 changes: 2 additions & 1 deletion sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3373,7 +3373,8 @@ class Dataset[T] private[sql](
plan = logicalPlan,
allowExisting = false,
replace = replace,
viewType = viewType)
viewType = viewType,
isAnalyzed = true)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ class ResolveSessionCatalog(val catalogManager: CatalogManager)
case SetTableLocation(ResolvedV1TableIdentifier(ident), partitionSpec, location) =>
AlterTableSetLocationCommand(ident.asTableIdentifier, partitionSpec, location)

case AlterViewAs(ResolvedView(ident, _), originalText, query) if query.resolved =>
case AlterViewAs(ResolvedView(ident, _), originalText, query) =>
AlterViewAsCommand(
ident.asTableIdentifier,
originalText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,17 @@ case class CreateViewCommand(
case class AlterViewAsCommand(
name: TableIdentifier,
originalText: String,
query: LogicalPlan) extends RunnableCommand {
query: LogicalPlan,
isAnalyzed: Boolean = false) extends RunnableCommand with AnalysisOnlyCommand {

import ViewHelper._

override def innerChildren: Seq[QueryPlan[_]] = Seq(query)

override def childrenToAnalyze: Seq[LogicalPlan] = query :: Nil

def markAsAnalyzed(): LogicalPlan = copy(isAnalyzed = true)

override def run(session: SparkSession): Seq[Row] = {
if (session.sessionState.catalog.isTempView(name)) {
alterTemporaryView(session, query)
Expand Down

0 comments on commit 0ab3653

Please sign in to comment.