{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/14444","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/14444/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/14444/comments","events_url":"https://api.github.com/repos/apache/spark/issues/14444/events","html_url":"https://github.com/apache/spark/pull/14444","id":168754565,"number":14444,"title":"[SPARK-16839] [SQL] redundant aliases after cleanupAliases","user":{"login":"eyalfa","id":1131833,"avatar_url":"https://avatars.githubusercontent.com/u/1131833?v=3","gravatar_id":"","url":"https://api.github.com/users/eyalfa","html_url":"https://github.com/eyalfa","followers_url":"https://api.github.com/users/eyalfa/followers","following_url":"https://api.github.com/users/eyalfa/following{/other_user}","gists_url":"https://api.github.com/users/eyalfa/gists{/gist_id}","starred_url":"https://api.github.com/users/eyalfa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eyalfa/subscriptions","organizations_url":"https://api.github.com/users/eyalfa/orgs","repos_url":"https://api.github.com/users/eyalfa/repos","events_url":"https://api.github.com/users/eyalfa/events{/privacy}","received_events_url":"https://api.github.com/users/eyalfa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":78,"created_at":"2016-08-01T22:13:06Z","updated_at":"2016-09-15T18:28:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/14444","html_url":"https://github.com/apache/spark/pull/14444","diff_url":"https://github.com/apache/spark/pull/14444.diff","patch_url":"https://github.com/apache/spark/pull/14444.patch"},"body":"## What changes were proposed in this pull request?\r\na failing test, \r\na fix that transforms CreateStruct into a CreateNamedStruct constructor, effectively eliminating CreateStruct from all expression trees.\r\nCleanupAliases code was simplified as it no longer has to deal with CreateStruct's top level attributes.\r\nand a minor modifications to test code (expect CrateNamedStruct instead of CreateStruct)\r\n\r\n## How was this patch tested?\r\nrunning all tests-suits in package org.apache.spark.sql, especially including the analysis suite, making sure added test initially fails, after applying suggested fix rerun the entire analysis package successfully.\r\n\r\n(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)\r\n\r\n\r\n(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/247411052","html_url":"https://github.com/apache/spark/pull/14444#issuecomment-247411052","issue_url":"https://api.github.com/repos/apache/spark/issues/14444","id":247411052,"user":{"login":"eyalfa","id":1131833,"avatar_url":"https://avatars.githubusercontent.com/u/1131833?v=3","gravatar_id":"","url":"https://api.github.com/users/eyalfa","html_url":"https://github.com/eyalfa","followers_url":"https://api.github.com/users/eyalfa/followers","following_url":"https://api.github.com/users/eyalfa/following{/other_user}","gists_url":"https://api.github.com/users/eyalfa/gists{/gist_id}","starred_url":"https://api.github.com/users/eyalfa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eyalfa/subscriptions","organizations_url":"https://api.github.com/users/eyalfa/orgs","repos_url":"https://api.github.com/users/eyalfa/repos","events_url":"https://api.github.com/users/eyalfa/events{/privacy}","received_events_url":"https://api.github.com/users/eyalfa/received_events","type":"User","site_admin":false},"created_at":"2016-09-15T18:28:37Z","updated_at":"2016-09-15T18:28:37Z","body":"Thanks,will do once I gain access to a computer.\nI'm not sure how well this is going to work since at the time\nCreateStruct.apply is invoked,it's quite possible that its children are not\nresolved yet,in most cases it's still possible to obtain the tree's\nname,Star is a very special case in that aspect.\nI'm afraid well see many struts loosing their attributes names.\n\nBut I'll give it a shot anyway.😁\n\nOn Sep 15, 2016 9:20 PM, \"Herman van Hovell\" <notifications@github.com>\nwrote:\n\n> *@hvanhovell* commented on this pull request.\n> ------------------------------\n>\n> In sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/\n> complexTypeCreator.scala\n> <https://github.com/apache/spark/pull/14444#pullrequestreview-224245>:\n>\n> > -\n> -  override lazy val dataType: StructType = {\n> -    val fields = children.zipWithIndex.map { case (child, idx) =>\n> -      child match {\n> -        case ne: NamedExpression =>\n> -          StructField(ne.name, ne.dataType, ne.nullable, ne.metadata)\n> -        case _ =>\n> -          StructField(s\"col${idx + 1}\", child.dataType, child.nullable, Metadata.empty)\n> +object CreateStruct extends (Seq[Expression] => CreateNamedStruct) {\n> +  def apply(children: Seq[Expression]) : CreateNamedStruct = {\n> +    val namedStructArgs = {\n> +      val attNames = for {\n> +        (child, idx) <- children.zipWithIndex\n> +      } yield {\n> +        child match {\n> +          case ne: NamedExpression => ne.name\n>\n> Please add if ne.resolved here and your PR should pass tests.\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/apache/spark/pull/14444#pullrequestreview-224245>, or mute\n> the thread\n> <https://github.com/notifications/unsubscribe-auth/ABFFOc6wLGmiY-CkwHvMcmNtUG5JpuWYks5qqYxtgaJpZM4JaDJr>\n> .\n>\n"}}
{"actor":{"display_login":"eyalfa"}}