Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/22524#discussion_r219690438 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala --- @@ -84,9 +84,10 @@ trait BaseLimitExec extends UnaryExecNode with CodegenSupport { s""" | if ($countTerm < $limit) { | $countTerm += 1; + | if ($countTerm == $limit) { + | $stopEarly = true; + | } | ${consume(ctx, input)} - | } else { --- End diff -- I think we don't execute into it. If we do, there should be a bug.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org