Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/22630#discussion_r222728236 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala --- @@ -66,27 +75,22 @@ trait BaseLimitExec extends UnaryExecNode with CodegenSupport { // to the parent operator. override def usedInputs: AttributeSet = AttributeSet.empty + private lazy val countTerm = BaseLimitExec.newLimitCountTerm() + + override lazy val conditionsOfKeepProducingData: Seq[String] = { + s"$countTerm < $limit" +: super.conditionsOfKeepProducingData --- End diff -- note that this is sub-optimal for adjacent limits, but I think it's fine as optimizer will merge adjacent limits.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org