-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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-49507][SQL] Fix Expected only partition pruning predicates exception #47998
base: master
Are you sure you want to change the base?
Conversation
b4543a5
to
b676fc0
Compare
cc @wangyum |
val boundPredicate = ExternalCatalogUtils.generatePartitionPredicateByFilter( | ||
catalogTable, partitionSchema, predicates) | ||
catalogTable, partitionSchema, transformedPredicates) |
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.
Because the catalogTable here is loaded directly from HMS, the partition fields are in lowercase instead of being restored to uppercase partition fields, which leads to this problem.
Because the catalog of conf.metastorePartitionPruning=false
has partition field names in uppercase, there is no such problem.
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/ExternalCatalogUtils.scala
Lines 163 to 173 in 319e7cc
def listPartitionsByFilter( | |
conf: SQLConf, | |
catalog: SessionCatalog, | |
table: CatalogTable, | |
partitionFilters: Seq[Expression]): Seq[CatalogTablePartition] = { | |
if (conf.metastorePartitionPruning) { | |
catalog.listPartitionsByFilter(table.identifier, partitionFilters) | |
} else { | |
ExternalCatalogUtils.prunePartitionsByFilter(table, catalog.listPartitions(table.identifier), | |
partitionFilters, conf.sessionLocalTimeZone) | |
} |
What changes were proposed in this pull request?
bug fix
Why are the changes needed?
How to reproduce:
Error msg:
Does this PR introduce any user-facing change?
No
How was this patch tested?
add ut
Was this patch authored or co-authored using generative AI tooling?
No