-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-33569][SQL] Remove getting partitions by an identifier prefix. #30514
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -17,6 +17,7 @@ | |||||||||
|
||||||||||
package org.apache.spark.sql.connector.catalog; | ||||||||||
|
||||||||||
import java.util.Arrays; | ||||||||||
import java.util.Map; | ||||||||||
|
||||||||||
import org.apache.spark.annotation.Experimental; | ||||||||||
|
@@ -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()); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we fail if the given BTW which command needs it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It uses in tests a lot, and in:
I guess, we can rewrite the cases. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like we always call it with a complete partition spec. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. anyway it's not related to this PR. |
||||||||||
return listPartitionIdentifiers(requiredNames, ident).length > 0; | ||||||||||
} | ||||||||||
|
||||||||||
/** | ||||||||||
|
@@ -105,20 +108,12 @@ void replacePartitionMetadata( | |||||||||
Map<String, String> loadPartitionMetadata(InternalRow ident) | ||||||||||
throws UnsupportedOperationException; | ||||||||||
|
||||||||||
/** | ||||||||||
* List the identifiers of all partitions that have the ident prefix in a table. | ||||||||||
* | ||||||||||
* @param ident a prefix of partition identifier | ||||||||||
* @return an array of Identifiers for the partitions | ||||||||||
*/ | ||||||||||
InternalRow[] listPartitionIdentifiers(InternalRow ident); | ||||||||||
|
||||||||||
/** | ||||||||||
* List the identifiers of all partitions that match to the ident by names. | ||||||||||
* | ||||||||||
* @param names the names of partition values in the identifier. | ||||||||||
* @param ident a partition identifier values. | ||||||||||
* @return an array of Identifiers for the partitions | ||||||||||
*/ | ||||||||||
InternalRow[] listPartitionByNames(String[] names, InternalRow ident); | ||||||||||
InternalRow[] listPartitionIdentifiers(String[] names, InternalRow ident); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR also changed this API. In the past, we coud use this API to check wether table had partitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the changes, you can do the same, right?