maropu commented on a change in pull request #29065:
URL: https://github.com/apache/spark/pull/29065#discussion_r499571886



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/DynamicPruning.scala
##########
@@ -66,8 +64,58 @@ case class DynamicPruningSubquery(
       buildKeys.forall(_.references.subsetOf(buildQuery.outputSet)) &&
       pruningKey.dataType == buildKeys(broadcastKeyIndex).dataType
   }
+}
+
+case class DynamicPartitionPruningSubquery(
+     pruningKey: Expression,
+     buildQuery: LogicalPlan,
+     buildKeys: Seq[Expression],
+     broadcastKeyIndex: Int,
+     onlyInBroadcast: Boolean,
+    override val exprId: ExprId = NamedExpression.newExprId)
+  extends DynamicPruningSubquery(
+    pruningKey, buildQuery, buildKeys, broadcastKeyIndex, onlyInBroadcast, 
exprId) {
+
+  override def children: Seq[Expression] = Seq(pruningKey)
+
+  override def plan: LogicalPlan = buildQuery
+
+  override def nullable: Boolean = false
+
+  override def withNewPlan(plan: LogicalPlan): DynamicPartitionPruningSubquery 
=
+    copy(buildQuery = plan)
+
+  override def toString: String = s"dynamicpartitionpruning#${exprId.id} 
$conditionString"
+
+  override lazy val canonicalized: DynamicPruning = {
+    copy(
+      pruningKey = pruningKey.canonicalized,
+      buildQuery = buildQuery.canonicalized,
+      buildKeys = buildKeys.map(_.canonicalized),
+      exprId = ExprId(0))
+  }
+}
+
+case class DynamicShufflePruningSubquery(

Review comment:
       Looks `DynamicPartitionPruningSubquery` and 
`DynamicShufflePruningSubquery` are almost the same, so we need this new 
predicate? Could we add a value to represent a pruning type in a class field of 
`DynamicPruningSubquery` like this?
   ```
   case class DynamicPruningSubquery(
       pruningKey: Expression,
       buildQuery: LogicalPlan,
       buildKeys: Seq[Expression],
       broadcastKeyIndex: Int,
       onlyInBroadcast: Boolean,
       exprId: ExprId,
       pruningType: PruningType) <---- This?
   ```




----------------------------------------------------------------
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]

Reply via email to