Github user davies commented on a diff in the pull request: https://github.com/apache/spark/pull/15980#discussion_r89365636 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala --- @@ -67,23 +67,14 @@ trait BaseLimitExec extends UnaryExecNode with CodegenSupport { } override def doConsume(ctx: CodegenContext, input: Seq[ExprCode], row: ExprCode): String = { - val stopEarly = ctx.freshName("stopEarly") - ctx.addMutableState("boolean", stopEarly, s"$stopEarly = false;") - - ctx.addNewFunction("shouldStop", s""" - @Override - protected boolean shouldStop() { - return !currentRows.isEmpty() || $stopEarly; - } - """) val countTerm = ctx.freshName("count") ctx.addMutableState("int", countTerm, s"$countTerm = 0;") s""" | if ($countTerm < $limit) { | $countTerm += 1; | ${consume(ctx, input)} | } else { - | $stopEarly = true; + | // Do nothing --- End diff -- This removes a optimization, I don't think this is a good fix. Can we initialize it properly?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org