cloud-fan commented on code in PR #57073:
URL: https://github.com/apache/spark/pull/57073#discussion_r3566805347
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CoalesceHintUtils.scala:
##########
@@ -40,6 +40,20 @@ object CoalesceHintUtils {
}
}
+ def getAdvisorySizeOfPartitions(hint: UnresolvedHint): (Option[Long],
Seq[Expression]) = {
Review Comment:
The advisory size isn't checked for positivity here, so
`REBALANCE_BY_SIZE(0)` is accepted (`0` parses as an `IntegerLiteral`), and
`df.hint("REBALANCE_BY_SIZE", -1)` passes a negative `Literal` straight
through. A size of `0` reaches `OptimizeSkewInRebalancePartitions`, where it's
used as both the skew threshold and the split target size, so every non-empty
partition is treated as skewed and split down to one-partition-per-map-block,
silently.
Every peer that handles this value rejects non-positive: `REBALANCE`'s num
path via `require(numPartitions > 0)`, the write producer via `if
(partitionSize > 0) Some else None` (`DistributionAndOrderingUtils`), and the
session config via `checkValue(_ > 0)`. I'd match the write producer and coerce
a non-positive value to the session default, and add a test for
`REBALANCE_BY_SIZE(0)`.
--
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]