Github user cloud-fan commented on the pull request: https://github.com/apache/spark/pull/5189#issuecomment-86327485 Since we decide to resolve `Sort` in `ResolveSortReferences`, then we need to stop resolve `Sort` in `ResolveReferences`. For example, test("quick") { jsonRDD(sparkContext.makeRDD( """{"a": {"b": 1}, "b": 2}""" :: """{"a": {"b": 2}, "b": 1}""" :: Nil)).registerTempTable("t") checkAnswer(sql("SELECT a.b FROM t ORDER BY b"), Seq(Row(2), Row(1))) } This test will fail, because we have mistakenly resolved `b` as `a.b` in `ResolveReferences`(we try to resolve `b` on top of `Projection("a.b")` and success). A quick fix is just make sure we don't resolve `Sort` in `ResolveReferences` like `case u @ UnresolvedAttribute(name) if !q.isInstanceOf[Sort]`. Do you have better idea @marmbrus ?
--- 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