Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
snazy committed Oct 9, 2023
1 parent 96575e4 commit 1fba65b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class NessieSqlExtensionsAstBuilder(delegate: ParserInterface)
val isBranch = ctx.TAG == null
val refName = ctx.reference.getText
val catalogName = asText(ctx.catalog)
DropReferenceCommand(refName, isBranch, catalogName)
val failOnDrop = ctx.IF() == null && ctx.EXISTS() == null
DropReferenceCommand(refName, isBranch, catalogName, failOnDrop)
}

override def visitNessieUseRef(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import org.apache.spark.sql.catalyst.expressions.Attribute
case class DropReferenceCommand(
reference: String,
isBranch: Boolean,
catalog: Option[String]
catalog: Option[String],
failOnDrop: Boolean
) extends LeafCommand {
override lazy val output: Seq[Attribute] =
NessieCommandOutputs.dropReferenceOutput()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ case class DropReferenceExec(
branch: String,
currentCatalog: CatalogPlugin,
isBranch: Boolean,
catalog: Option[String]
catalog: Option[String],
failOnDrop: Boolean
) extends BaseDropReferenceExec(
output,
branch,
currentCatalog,
isBranch,
catalog
catalog,
failOnDrop
)
with LeafV2CommandExec {}
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ case class NessieExtendedDataSourceV2Strategy(spark: SparkSession)
failOnCreate
) :: Nil

case c @ DropReferenceCommand(branch, isBranch, catalog) =>
case c @ DropReferenceCommand(branch, isBranch, catalog, failOnDrop) =>
DropReferenceExec(
c.output,
branch,
spark.sessionState.catalogManager.currentCatalog,
isBranch,
catalog
catalog,
failOnDrop
) :: Nil

case c @ UseReferenceCommand(branch, ts, catalog) =>
Expand Down

0 comments on commit 1fba65b

Please sign in to comment.