{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/15807","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/15807/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/15807/comments","events_url":"https://api.github.com/repos/apache/spark/issues/15807/events","html_url":"https://github.com/apache/spark/pull/15807","id":187930613,"number":15807,"title":"[SPARK-18147][SQL] do not fail for very complex aggregator result type","user":{"login":"cloud-fan","id":3182036,"avatar_url":"https://avatars.githubusercontent.com/u/3182036?v=3","gravatar_id":"","url":"https://api.github.com/users/cloud-fan","html_url":"https://github.com/cloud-fan","followers_url":"https://api.github.com/users/cloud-fan/followers","following_url":"https://api.github.com/users/cloud-fan/following{/other_user}","gists_url":"https://api.github.com/users/cloud-fan/gists{/gist_id}","starred_url":"https://api.github.com/users/cloud-fan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloud-fan/subscriptions","organizations_url":"https://api.github.com/users/cloud-fan/orgs","repos_url":"https://api.github.com/users/cloud-fan/repos","events_url":"https://api.github.com/users/cloud-fan/events{/privacy}","received_events_url":"https://api.github.com/users/cloud-fan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-11-08T08:33:25Z","updated_at":"2016-11-08T15:51:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/15807","html_url":"https://github.com/apache/spark/pull/15807","diff_url":"https://github.com/apache/spark/pull/15807.diff","patch_url":"https://github.com/apache/spark/pull/15807.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nIn `TypedAggregateExpression.evaluateExpression`, we may create `ReferenceToExpressions` with `CreateStruct`, and `CreateStruct` may generate too many codes and split them into several methods.  `ReferenceToExpressions` will replace `BoundReference` in `CreateStruct` with `LambdaVariable`, which can only be used as local variables and doesn't work if we split the generated code.\r\n\r\nInstead of fixing `ReferenceToExpressions`, fortunately we can just remove it.\r\n\r\n`ReferenceToExpressions` was introduced in https://github.com/apache/spark/pull/12067 , to work around a performance issue about subexpression elimination with whole stage codegen.\r\nThen in https://github.com/apache/spark/pull/12729 we added the support of subexpression elimination with whole stage codegen, so `ReferenceToExpressions` is no longer needed.\r\n\r\n## How was this patch tested?\r\n\r\nnew test in `DatasetAggregatorSuite`\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/259174161","html_url":"https://github.com/apache/spark/pull/15807#issuecomment-259174161","issue_url":"https://api.github.com/repos/apache/spark/issues/15807","id":259174161,"user":{"login":"kiszk","id":1315079,"avatar_url":"https://avatars.githubusercontent.com/u/1315079?v=3","gravatar_id":"","url":"https://api.github.com/users/kiszk","html_url":"https://github.com/kiszk","followers_url":"https://api.github.com/users/kiszk/followers","following_url":"https://api.github.com/users/kiszk/following{/other_user}","gists_url":"https://api.github.com/users/kiszk/gists{/gist_id}","starred_url":"https://api.github.com/users/kiszk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiszk/subscriptions","organizations_url":"https://api.github.com/users/kiszk/orgs","repos_url":"https://api.github.com/users/kiszk/repos","events_url":"https://api.github.com/users/kiszk/events{/privacy}","received_events_url":"https://api.github.com/users/kiszk/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T15:51:46Z","updated_at":"2016-11-08T15:51:46Z","body":"In general, in addtion to bad performance, it may lead to an incorrect result  if `subexpr2` is always evaluated. When `subexpr` is null, to evaluate `subexpr2` may throw an exception.\r\nA compiler has to carefully move statements beyond a conditional branch."}}
{"actor":{"display_login":"kiszk"}}