Skip to content

Commit b1fc84b

Browse files
author
stczwd
committed
change the warning for purge
Change-Id: I11a9dc214102854f533330a739d32a41500d9278
1 parent 61cae52 commit b1fc84b

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveCatalogs.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,14 @@ class ResolveCatalogs(val catalogManager: CatalogManager)
249249

250250
case c @ AlterTableDropPartitionStatement(
251251
NonSessionCatalogAndTable(catalog, tableName), _, _, _, _) =>
252+
if (c.purge) {
253+
logWarning("PURGE won't take effect here, please put it in table properties")
254+
}
252255
val table = catalog.asTableCatalog.loadTable(tableName.asIdentifier).asPartitionable
253256
AlterTableDropPartition(
254257
table,
255258
c.specs.map(_.asPartitionIdentifier(table.partitionSchema())),
256-
c.ifExists,
257-
c.purge,
258-
c.retainData)
259+
c.ifExists)
259260
}
260261

261262
object NonSessionCatalogAndTable {

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -573,12 +573,10 @@ case class AlterTableAddPartition(
573573
*
574574
* The syntax of this command is:
575575
* {{{
576-
* ALTER TABLE table DROP [IF EXISTS] PARTITION spec1[, PARTITION spec2, ...] [PURGE];
576+
* ALTER TABLE table DROP [IF EXISTS] PARTITION spec1[, PARTITION spec2, ...];
577577
* }}}
578578
*/
579579
case class AlterTableDropPartition(
580580
table: SupportsPartitions,
581581
partIdents: Seq[InternalRow],
582-
ignoreIfNotExists: Boolean,
583-
purge: Boolean,
584-
retainData: Boolean) extends Command
582+
ignoreIfNotExists: Boolean) extends Command

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AlterTableDropPartitionExec.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,11 @@ import org.apache.spark.sql.connector.catalog.SupportsPartitions
2828
case class AlterTableDropPartitionExec(
2929
table: SupportsPartitions,
3030
partIdents: Seq[InternalRow],
31-
ignoreIfNotExists: Boolean,
32-
purge: Boolean,
33-
retainData: Boolean) extends V2CommandExec {
31+
ignoreIfNotExists: Boolean) extends V2CommandExec {
3432

3533
override def output: Seq[Attribute] = Seq.empty
3634

3735
override protected def run(): Seq[InternalRow] = {
38-
logWarning("PURGE won't take effect, please put it in table properties")
39-
4036
partIdents.foreach { partIdent =>
4137
if (!table.dropPartition(partIdent) && !ignoreIfNotExists) {
4238
throw new NoSuchPartitionException(table.name(), partIdent, table.partitionSchema())

sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2Strategy.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat
279279
case AlterTableAddPartition(table, parts, ignoreIfExists) =>
280280
AlterTableAddPartitionExec(table, parts, ignoreIfExists) :: Nil
281281

282-
case AlterTableDropPartition(table, partIdents, ignoreIfNotExists, purge, retainData) =>
282+
case AlterTableDropPartition(table, partIdents, ignoreIfNotExists) =>
283283
AlterTableDropPartitionExec(
284-
table, partIdents, ignoreIfNotExists, purge, retainData) :: Nil
284+
table, partIdents, ignoreIfNotExists) :: Nil
285285

286286
case _ => Nil
287287
}

0 commit comments

Comments
 (0)