Skip to content

Commit

Permalink
[SPARK-34524][SQL][FOLLOWUP] Remove unused checkAlterTablePartition i…
Browse files Browse the repository at this point in the history
…n CheckAnalysis.scala

### What changes were proposed in this pull request?

apache#31637 removed the usage of `CheckAnalysis.checkAlterTablePartition` but didn't remove the function.

### Why are the changes needed?

To removed an unused function.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Existing tests.

Closes apache#32855 from imback82/SPARK-34524-followup.

Authored-by: Terry Kim <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
  • Loading branch information
imback82 authored and cloud-fan committed Jun 10, 2021
1 parent 5280f02 commit 88f1d82
Showing 1 changed file with 1 addition and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.apache.spark.sql.catalyst.optimizer.BooleanSimplification
import org.apache.spark.sql.catalyst.plans._
import org.apache.spark.sql.catalyst.plans.logical._
import org.apache.spark.sql.catalyst.util.{CharVarcharUtils, TypeUtils}
import org.apache.spark.sql.connector.catalog.{LookupCatalog, SupportsAtomicPartitionManagement, SupportsPartitionManagement, Table}
import org.apache.spark.sql.connector.catalog.{LookupCatalog, SupportsPartitionManagement}
import org.apache.spark.sql.connector.catalog.TableChange.{AddColumn, After, ColumnPosition, DeleteColumn, RenameColumn, UpdateColumnComment, UpdateColumnNullability, UpdateColumnPosition, UpdateColumnType}
import org.apache.spark.sql.errors.{QueryCompilationErrors, QueryExecutionErrors}
import org.apache.spark.sql.internal.SQLConf
Expand Down Expand Up @@ -1070,24 +1070,4 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
failOnOuterReferenceInSubTree(p)
}}
}

// Make sure that table is able to alter partition.
private def checkAlterTablePartition(
table: Table, parts: Seq[PartitionSpec]): Unit = {
(table, parts) match {
case (table, _) if !table.isInstanceOf[SupportsPartitionManagement] =>
failAnalysis(s"Table ${table.name()} can not alter partitions.")

case (_, parts) if parts.exists(_.isInstanceOf[UnresolvedPartitionSpec]) =>
failAnalysis("PartitionSpecs are not resolved")

// Skip atomic partition tables
case (_: SupportsAtomicPartitionManagement, _) =>
case (_: SupportsPartitionManagement, parts) if parts.size > 1 =>
failAnalysis(
s"Nonatomic partition table ${table.name()} can not alter multiple partitions.")

case _ =>
}
}
}

0 comments on commit 88f1d82

Please sign in to comment.