{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/20763","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/20763/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/20763/comments","events_url":"https://api.github.com/repos/apache/spark/issues/20763/events","html_url":"https://github.com/apache/spark/pull/20763","id":303303309,"number":20763,"title":"[SPARK-23523] [SQL] [BACKPORT-2.3] Fix the incorrect result caused by the rule OptimizeMetadataOnlyQuery","user":{"login":"gatorsmile","id":11567269,"avatar_url":"https://avatars1.githubusercontent.com/u/11567269?v=4","gravatar_id":"","url":"https://api.github.com/users/gatorsmile","html_url":"https://github.com/gatorsmile","followers_url":"https://api.github.com/users/gatorsmile/followers","following_url":"https://api.github.com/users/gatorsmile/following{/other_user}","gists_url":"https://api.github.com/users/gatorsmile/gists{/gist_id}","starred_url":"https://api.github.com/users/gatorsmile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gatorsmile/subscriptions","organizations_url":"https://api.github.com/users/gatorsmile/orgs","repos_url":"https://api.github.com/users/gatorsmile/repos","events_url":"https://api.github.com/users/gatorsmile/events{/privacy}","received_events_url":"https://api.github.com/users/gatorsmile/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2018-03-07T23:48:40Z","updated_at":"2018-03-11T15:37:25Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/20763","html_url":"https://github.com/apache/spark/pull/20763","diff_url":"https://github.com/apache/spark/pull/20763.diff","patch_url":"https://github.com/apache/spark/pull/20763.patch"},"body":"This PR is to backport https://github.com/apache/spark/pull/20684 and https://github.com/apache/spark/pull/20693 to Spark 2.3 branch\r\n\r\n---\r\n\r\n## What changes were proposed in this pull request?\r\n```Scala\r\nval tablePath = new File(s\"${path.getCanonicalPath}/cOl3=c/cOl1=a/cOl5=e\")\r\n Seq((\"a\", \"b\", \"c\", \"d\", \"e\")).toDF(\"cOl1\", \"cOl2\", \"cOl3\", \"cOl4\", \"cOl5\")\r\n .write.json(tablePath.getCanonicalPath)\r\n val df = spark.read.json(path.getCanonicalPath).select(\"CoL1\", \"CoL5\", \"CoL3\").distinct()\r\n df.show()\r\n```\r\n\r\nIt generates a wrong result.\r\n```\r\n[c,e,a]\r\n```\r\n\r\nWe have a bug in the rule `OptimizeMetadataOnlyQuery `. We should respect the attribute order in the original leaf node. This PR is to fix it.\r\n\r\n## How was this patch tested?\r\nAdded a test case"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/372124427","html_url":"https://github.com/apache/spark/pull/20763#issuecomment-372124427","issue_url":"https://api.github.com/repos/apache/spark/issues/20763","id":372124427,"user":{"login":"AmplabJenkins","id":4031291,"avatar_url":"https://avatars3.githubusercontent.com/u/4031291?v=4","gravatar_id":"","url":"https://api.github.com/users/AmplabJenkins","html_url":"https://github.com/AmplabJenkins","followers_url":"https://api.github.com/users/AmplabJenkins/followers","following_url":"https://api.github.com/users/AmplabJenkins/following{/other_user}","gists_url":"https://api.github.com/users/AmplabJenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/AmplabJenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmplabJenkins/subscriptions","organizations_url":"https://api.github.com/users/AmplabJenkins/orgs","repos_url":"https://api.github.com/users/AmplabJenkins/repos","events_url":"https://api.github.com/users/AmplabJenkins/events{/privacy}","received_events_url":"https://api.github.com/users/AmplabJenkins/received_events","type":"User","site_admin":false},"created_at":"2018-03-11T15:37:25Z","updated_at":"2018-03-11T15:37:25Z","author_association":"NONE","body":"Test PASSed.\nRefer to this link for build results (access rights to CI server needed): \nhttps://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1455/\nTest PASSed."}}
{"actor":{"display_login":"AmplabJenkins"}}