cloud-fan commented on code in PR #36417: URL: https://github.com/apache/spark/pull/36417#discussion_r866554687
########## sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala: ########## @@ -70,9 +78,11 @@ case class CollectLimitExec( val singlePartitionRDD = if (childRDD.getNumPartitions == 1) { childRDD } else { - val locallyLimited = - offsetOpt.map(offset => childRDD.mapPartitionsInternal(_.take(limit + offset))) - .getOrElse(childRDD.mapPartitionsInternal(_.take(limit))) + val locallyLimited = if (offset > 0) { Review Comment: We also need to take care of the case if `limit = -1` -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org