MaxGekk commented on a change in pull request #30667:
URL: https://github.com/apache/spark/pull/30667#discussion_r538136623
##########
File path:
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/SupportsPartitionManagement.java
##########
@@ -80,9 +79,14 @@ void createPartition(
* @return true if the partition exists, false otherwise
*/
default boolean partitionExists(InternalRow ident) {
- String[] partitionNames = partitionSchema().names();
- String[] requiredNames = Arrays.copyOfRange(partitionNames, 0,
ident.numFields());
- return listPartitionIdentifiers(requiredNames, ident).length > 0;
+ String[] partitionNames = partitionSchema().names();
+ if (ident.numFields() == partitionNames.length) {
+ return listPartitionIdentifiers(partitionNames, ident).length > 0;
+ } else {
+ throw new IllegalArgumentException("The number of fields (" +
ident.numFields() +
Review comment:
Currently, it shouldn't especially after this PR
https://github.com/apache/spark/pull/30624. Maybe I missed some places but as
far as I can see, all calls of `partitionExists()` pass fully specified
partition ids.
----------------------------------------------------------------
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]