Github user rxin commented on a diff in the pull request: https://github.com/apache/spark/pull/4336#discussion_r24053977 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameImpl.scala --- @@ -260,11 +260,11 @@ private[sql] class DataFrameImpl protected[sql]( override def take(n: Int): Array[Row] = head(n) - override def collect(): Array[Row] = queryExecution.executedPlan.executeCollect() + override def collect(): Array[Row] = rdd.collect() override def collectAsList(): java.util.List[Row] = java.util.Arrays.asList(rdd.collect() :_*) - override def count(): Long = groupBy().count().rdd.collect().head.getLong(0) + override def count(): Long = rdd.count() --- End diff -- @marmbrus is correct. rdd.count() doesn't go through the optimizer. The original solution goes through the optimizer. Maybe a better change is to add some inline comment to explain this makes sure it goes through the optimizer, etc.
--- 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