sunchao commented on a change in pull request #33348:
URL: https://github.com/apache/spark/pull/33348#discussion_r670125162
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CatalogFileIndex.scala
##########
@@ -94,6 +93,19 @@ class CatalogFileIndex(
}
}
+ private def listPartitionsByFilter(
+ table: CatalogTable,
+ partitionFilters: Seq[Expression]): Seq[CatalogTablePartition] = {
+ if (sparkSession.sessionState.conf.metastorePartitionPruning) {
+ sparkSession.sessionState.catalog.listPartitionsByFilter(
+ table.identifier, partitionFilters)
+ } else {
+ ExternalCatalogUtils.prunePartitionsByFilter(table,
+ sparkSession.sessionState.catalog.listPartitions(table.identifier),
+ partitionFilters, sparkSession.sessionState.conf.sessionLocalTimeZone)
+ }
+ }
Review comment:
Good suggestion. I tried this at the beginning but stopped since
`SparkSession` was not visible in `catalyst` module, but seems we can just pass
the `SessionCatalog` as method parameter instead.
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/CatalogFileIndex.scala
##########
@@ -94,6 +93,19 @@ class CatalogFileIndex(
}
}
+ private def listPartitionsByFilter(
+ table: CatalogTable,
+ partitionFilters: Seq[Expression]): Seq[CatalogTablePartition] = {
+ if (sparkSession.sessionState.conf.metastorePartitionPruning) {
+ sparkSession.sessionState.catalog.listPartitionsByFilter(
+ table.identifier, partitionFilters)
+ } else {
+ ExternalCatalogUtils.prunePartitionsByFilter(table,
+ sparkSession.sessionState.catalog.listPartitions(table.identifier),
+ partitionFilters, sparkSession.sessionState.conf.sessionLocalTimeZone)
+ }
+ }
Review comment:
Good suggestion. I tried this at the beginning but stopped since
`SparkSession` is not visible in `catalyst` module, but seems we can just pass
the `SessionCatalog` as method parameter instead.
--
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]