HyukjinKwon commented on code in PR #48108:
URL: https://github.com/apache/spark/pull/48108#discussion_r1762451721


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DropPartitionExec.scala:
##########
@@ -37,15 +39,23 @@ case class DropPartitionExec(
   override def output: Seq[Attribute] = Seq.empty
 
   override protected def run(): Seq[InternalRow] = {
-    val (existsPartIdents, notExistsPartIdents) =
-      partSpecs.map(_.ident).partition(table.partitionExists)
+    val existsPartIdents: mutable.Set[InternalRow] = mutable.Set()
+    val notExistsPartIdents: mutable.Set[InternalRow] = mutable.Set()
+    partSpecs.foreach(partSpec => {

Review Comment:
   ```suggestion
       partSpecs.foreach { partSpec =>
   ```



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DropPartitionExec.scala:
##########
@@ -37,15 +39,23 @@ case class DropPartitionExec(
   override def output: Seq[Attribute] = Seq.empty
 
   override protected def run(): Seq[InternalRow] = {
-    val (existsPartIdents, notExistsPartIdents) =
-      partSpecs.map(_.ident).partition(table.partitionExists)
+    val existsPartIdents: mutable.Set[InternalRow] = mutable.Set()
+    val notExistsPartIdents: mutable.Set[InternalRow] = mutable.Set()
+    partSpecs.foreach(partSpec => {
+      val partIdents = table.listPartitionIdentifiers(partSpec.names.toArray, 
partSpec.ident)
+      if (partIdents.nonEmpty) {
+        existsPartIdents.addAll(partIdents)
+      } else {
+        notExistsPartIdents.add(partSpec.ident)
+      }
+    })

Review Comment:
   ```suggestion
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to