peter-toth commented on code in PR #37525:
URL: https://github.com/apache/spark/pull/37525#discussion_r951569244
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoinExec.scala:
##########
@@ -112,28 +113,12 @@ case class BroadcastHashJoinExec(
// Seq("a", "b", "c"), Seq("a", "b", "y"), Seq("a", "x", "c"), Seq("a", "x",
"y").
// The expanded expressions are returned as PartitioningCollection.
private def expandOutputPartitioning(partitioning: HashPartitioning):
PartitioningCollection = {
- val maxNumCombinations =
conf.broadcastHashJoinOutputPartitioningExpandLimit
- var currentNumCombinations = 0
-
- def generateExprCombinations(
- current: Seq[Expression],
- accumulated: Seq[Expression]): Seq[Seq[Expression]] = {
- if (currentNumCombinations >= maxNumCombinations) {
- Nil
- } else if (current.isEmpty) {
- currentNumCombinations += 1
- Seq(accumulated)
- } else {
- val buildKeysOpt =
streamedKeyToBuildKeyMapping.get(current.head.canonicalized)
- generateExprCombinations(current.tail, accumulated :+ current.head) ++
- buildKeysOpt.map(_.flatMap(b =>
generateExprCombinations(current.tail, accumulated :+ b)))
- .getOrElse(Nil)
- }
- }
-
- PartitioningCollection(
- generateExprCombinations(partitioning.expressions, Nil)
- .map(HashPartitioning(_, partitioning.numPartitions)))
+ PartitioningCollection(partitioning.multiTransform {
Review Comment:
I realized that the logic added in
https://github.com/apache/spark/pull/28676 can be easily rewritten with the new
`multiTransform()`. But if the rewrite should be independent to this PR then I
can revert this part
(https://github.com/apache/spark/pull/37525/commits/765feffe2b3d371f57b66ea38bf89a7efe5721b8).
--
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]