You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/09/28 02:33:43 UTC
[GitHub] [spark] maropu commented on a change in pull request #29831: [SPARK-32351][SQL] Show partially pushed down partition filters in explain()
maropu commented on a change in pull request #29831:
URL: https://github.com/apache/spark/pull/29831#discussion_r495660147
##########
File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveStrategies.scala
##########
@@ -254,22 +254,28 @@ private[hive] trait HiveStrategies {
* Retrieves data using a HiveTableScan. Partition pruning predicates are also detected and
* applied.
*/
- object HiveTableScans extends Strategy {
+ object HiveTableScans extends Strategy with PredicateHelper {
def apply(plan: LogicalPlan): Seq[SparkPlan] = plan match {
- case ScanOperation(projectList, predicates, relation: HiveTableRelation) =>
+ case ScanOperation(projectList, filters, relation: HiveTableRelation) =>
// Filter out all predicates that only deal with partition keys, these are given to the
// hive table scan operator to be used for partition pruning.
val partitionKeyIds = AttributeSet(relation.partitionCols)
- val (pruningPredicates, otherPredicates) = predicates.partition { predicate =>
- !predicate.references.isEmpty &&
- predicate.references.subsetOf(partitionKeyIds)
+ val normalized = DataSourceStrategy.normalizeExprs(
+ filters.filter(_.deterministic), relation.output)
+ val partitionKeyFilters = if (relation.partitionCols.isEmpty) {
Review comment:
btw, this code part looks the same with `FileSourceStrategy`, so could we share the code between them? (for preventing us from updating the one side and forgetting to update the other side)
##########
File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveStrategies.scala
##########
@@ -254,22 +254,28 @@ private[hive] trait HiveStrategies {
* Retrieves data using a HiveTableScan. Partition pruning predicates are also detected and
* applied.
*/
- object HiveTableScans extends Strategy {
+ object HiveTableScans extends Strategy with PredicateHelper {
def apply(plan: LogicalPlan): Seq[SparkPlan] = plan match {
- case ScanOperation(projectList, predicates, relation: HiveTableRelation) =>
+ case ScanOperation(projectList, filters, relation: HiveTableRelation) =>
// Filter out all predicates that only deal with partition keys, these are given to the
// hive table scan operator to be used for partition pruning.
val partitionKeyIds = AttributeSet(relation.partitionCols)
- val (pruningPredicates, otherPredicates) = predicates.partition { predicate =>
- !predicate.references.isEmpty &&
- predicate.references.subsetOf(partitionKeyIds)
+ val normalized = DataSourceStrategy.normalizeExprs(
Review comment:
nit: `normalized` -> `normalizedFilters`
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org