MaxGekk commented on a change in pull request #30514:
URL: https://github.com/apache/spark/pull/30514#discussion_r532491800



##########
File path: 
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java
##########
@@ -79,7 +80,9 @@ void createPartition(
      * @return true if the partition exists, false otherwise
      */
     default boolean partitionExists(InternalRow ident) {
-        return listPartitionIdentifiers(ident).length > 0;
+        String[] partitionNames = partitionSchema().names();
+        String[] requiredNames = Arrays.copyOfRange(partitionNames, 0, 
ident.numFields());

Review comment:
       It uses in tests a lot, and in:
   - 
https://github.com/apache/spark/blob/60fa8e304d1284c269b8ac6be9a3fd65197ef6ec/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryAtomicPartitionTable.scala#L61
   - 
https://github.com/apache/spark/blob/60fa8e304d1284c269b8ac6be9a3fd65197ef6ec/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/InMemoryAtomicPartitionTable.scala#L71
   - 
https://github.com/apache/spark/blob/1eb236b9360a000afc30424341698fe26ee96d0f/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AlterTableAddPartitionExec.scala#L40
   - 
https://github.com/apache/spark/blob/1eb236b9360a000afc30424341698fe26ee96d0f/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/AlterTableDropPartitionExec.scala#L38
   
   I guess, we can rewrite the cases.




----------------------------------------------------------------
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.

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