maropu commented on a change in pull request #27828: [SPARK-31068][SQL] Avoid IllegalArgumentException in broadcast exchange URL: https://github.com/apache/spark/pull/27828#discussion_r389342924
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala ########## @@ -87,9 +87,12 @@ case class BroadcastExchangeExec( val beforeCollect = System.nanoTime() // Use executeCollect/executeCollectIterator to avoid conversion to Scala types val (numRows, input) = child.executeCollectIterator() - if (numRows >= 512000000) { + // Since the maximum number of keys that BytesToBytesMap supports is 1 << 29, + // and only 70% of the slots can be used before growing in HashedRelation, + // here the limitation should not be over 341 million. + if (numRows >= (1 << 29) / 1.5) { throw new SparkException( - s"Cannot broadcast the table with 512 million or more rows: $numRows rows") + s"Cannot broadcast the table with 341 million or more rows: $numRows rows") Review comment: Yea, +1 on the Sean's suggestion. btw, could we make this error message clearer? I personally think the current message looks unobvious for users. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org