Skip to content
Closed
Prev Previous commit
Next Next commit
address comments.
  • Loading branch information
gatorsmile committed Jul 8, 2016
commit f600ba4f4455890b17080bc1cd3f647ec9023799
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,12 @@ case class GlobalLimit(limitExpr: Expression, child: LogicalPlan) extends UnaryN
}
override lazy val statistics: Statistics = {
val limit = limitExpr.eval().asInstanceOf[Int]
var sizeInBytes = (limit: Long) * output.map(a => a.dataType.defaultSize).sum
if (sizeInBytes == 0) {
val sizeInBytes = if (limit == 0) {
// sizeInBytes can't be zero, or sizeInBytes of BinaryNode will also be zero
// (product of children).
sizeInBytes = 1
1
} else {
(limit: Long) * output.map(a => a.dataType.defaultSize).sum
}
child.statistics.copy(sizeInBytes = sizeInBytes)
}
Expand All @@ -680,11 +681,12 @@ case class LocalLimit(limitExpr: Expression, child: LogicalPlan) extends UnaryNo
}
override lazy val statistics: Statistics = {
val limit = limitExpr.eval().asInstanceOf[Int]
var sizeInBytes = (limit: Long) * output.map(a => a.dataType.defaultSize).sum
if (sizeInBytes == 0) {
val sizeInBytes = if (limit == 0) {
// sizeInBytes can't be zero, or sizeInBytes of BinaryNode will also be zero
// (product of children).
sizeInBytes = 1
1
} else {
(limit: Long) * output.map(a => a.dataType.defaultSize).sum
}
child.statistics.copy(sizeInBytes = sizeInBytes)
}
Expand Down