Github user JoshRosen commented on a diff in the pull request: https://github.com/apache/spark/pull/15030#discussion_r78434025 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala --- @@ -148,8 +148,8 @@ case class TakeOrderedAndProjectExec( localTopK, child.output, SinglePartition, serializer)) shuffled.mapPartitions { iter => val topK = org.apache.spark.util.collection.Utils.takeOrdered(iter.map(_.copy()), limit)(ord) - if (projectList.isDefined) { - val proj = UnsafeProjection.create(projectList.get, child.output) + if (AttributeSet(projectList) != child.outputSet) { --- End diff -- Should this be order-insensitive, set-based comparision or should it be using `AttributeSeq` instead? I'm wondering whether we could hit a bug in case the project happens to permute the child output columns, since in that case I think we'd end up skipping the final column-reordering projection.
--- 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