cloud-fan commented on code in PR #51451:
URL: https://github.com/apache/spark/pull/51451#discussion_r2536897227
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala:
##########
@@ -580,39 +580,37 @@ case class Union(
allowMissingCol: Boolean = false) extends UnionBase {
assert(!allowMissingCol || byName, "`allowMissingCol` can be true only if
`byName` is true.")
- override def maxRows: Option[Long] = {
- var sum = BigInt(0)
- children.foreach { child =>
- if (child.maxRows.isDefined) {
- sum += child.maxRows.get
- if (!sum.isValidLong) {
- return None
+ override lazy val maxRows: Option[Long] = {
Review Comment:
`lazy val` is not free and it has overhead. We should only use lazy val when
it's beneficial like here, but not blindly in everywhere.
--
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]