{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/32998276","id":32998276,"diff_hunk":"@@ -0,0 +1,43 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements.  See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License.  You may obtain a copy of the License at\n+ *\n+ *    http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.apache.spark.sql.execution\n+\n+import org.apache.spark.SparkEnv\n+import org.apache.spark.sql.catalyst.expressions._\n+import org.apache.spark.sql.test.TestSQLContext\n+import org.apache.spark.sql.types.DataTypes._\n+\n+class AggregateSuite extends SparkPlanTest {\n+\n+  test(\"SPARK-8357 Memory leakage on unsafe aggregation path with empty input\") {\n+\n+    val df = Seq.empty[(String, Int, Double)].toDF(\"a\", \"b\", \"c\")\n+\n+    val groupExpr = df.col(\"b\").expr\n+    val aggrExpr = Alias(Count(Cast(groupExpr, LongType)), \"Count\")()\n+\n+    SparkEnv.get.conf.set(\"spark.unsafe.exceptionOnMemoryLeak\", \"true\")\n+    for (codegen <- Seq(false, true); partial <- Seq(false, true); unsafe <- Seq(false, true)) {","path":"sql/core/src/test/scala/org/apache/spark/sql/execution/AggregateSuite.scala","position":35,"original_position":35,"commit_id":"0a5bf170a1ed89344f2a57bd891154c17a6c44f8","original_commit_id":"0a5bf170a1ed89344f2a57bd891154c17a6c44f8","user":{"login":"navis","id":809395,"avatar_url":"https://avatars.githubusercontent.com/u/809395?v=3","gravatar_id":"","url":"https://api.github.com/users/navis","html_url":"https://github.com/navis","followers_url":"https://api.github.com/users/navis/followers","following_url":"https://api.github.com/users/navis/following{/other_user}","gists_url":"https://api.github.com/users/navis/gists{/gist_id}","starred_url":"https://api.github.com/users/navis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navis/subscriptions","organizations_url":"https://api.github.com/users/navis/orgs","repos_url":"https://api.github.com/users/navis/repos","events_url":"https://api.github.com/users/navis/events{/privacy}","received_events_url":"https://api.github.com/users/navis/received_events","type":"User","site_admin":false},"body":"Ok, I'll do that.","created_at":"2015-06-23T00:04:19Z","updated_at":"2015-06-23T00:04:19Z","html_url":"https://github.com/apache/spark/pull/6810#discussion_r32998276","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/6810","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/32998276"},"html":{"href":"https://github.com/apache/spark/pull/6810#discussion_r32998276"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/6810"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/6810","id":37635390,"html_url":"https://github.com/apache/spark/pull/6810","diff_url":"https://github.com/apache/spark/pull/6810.diff","patch_url":"https://github.com/apache/spark/pull/6810.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/6810","number":6810,"state":"open","locked":false,"title":"[SPARK-8357] [SQL] Memory leakage on unsafe aggregation path with empty input","user":{"login":"navis","id":809395,"avatar_url":"https://avatars.githubusercontent.com/u/809395?v=3","gravatar_id":"","url":"https://api.github.com/users/navis","html_url":"https://github.com/navis","followers_url":"https://api.github.com/users/navis/followers","following_url":"https://api.github.com/users/navis/following{/other_user}","gists_url":"https://api.github.com/users/navis/gists{/gist_id}","starred_url":"https://api.github.com/users/navis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navis/subscriptions","organizations_url":"https://api.github.com/users/navis/orgs","repos_url":"https://api.github.com/users/navis/repos","events_url":"https://api.github.com/users/navis/events{/privacy}","received_events_url":"https://api.github.com/users/navis/received_events","type":"User","site_admin":false},"body":"Currently, unsafe-based hash is released on 'next' call but if input is empty, it would not be called ever. ","created_at":"2015-06-14T03:11:46Z","updated_at":"2015-06-23T00:04:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"323e91ae6b7ae56710394b61cbe72356ec0c3b41","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/6810/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/6810/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/6810/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/0a5bf170a1ed89344f2a57bd891154c17a6c44f8","head":{"label":"navis:SPARK-8357","ref":"SPARK-8357","sha":"0a5bf170a1ed89344f2a57bd891154c17a6c44f8","user":{"login":"navis","id":809395,"avatar_url":"https://avatars.githubusercontent.com/u/809395?v=3","gravatar_id":"","url":"https://api.github.com/users/navis","html_url":"https://github.com/navis","followers_url":"https://api.github.com/users/navis/followers","following_url":"https://api.github.com/users/navis/following{/other_user}","gists_url":"https://api.github.com/users/navis/gists{/gist_id}","starred_url":"https://api.github.com/users/navis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navis/subscriptions","organizations_url":"https://api.github.com/users/navis/orgs","repos_url":"https://api.github.com/users/navis/repos","events_url":"https://api.github.com/users/navis/events{/privacy}","received_events_url":"https://api.github.com/users/navis/received_events","type":"User","site_admin":false},"repo":{"id":36485276,"name":"spark","full_name":"navis/spark","owner":{"login":"navis","id":809395,"avatar_url":"https://avatars.githubusercontent.com/u/809395?v=3","gravatar_id":"","url":"https://api.github.com/users/navis","html_url":"https://github.com/navis","followers_url":"https://api.github.com/users/navis/followers","following_url":"https://api.github.com/users/navis/following{/other_user}","gists_url":"https://api.github.com/users/navis/gists{/gist_id}","starred_url":"https://api.github.com/users/navis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navis/subscriptions","organizations_url":"https://api.github.com/users/navis/orgs","repos_url":"https://api.github.com/users/navis/repos","events_url":"https://api.github.com/users/navis/events{/privacy}","received_events_url":"https://api.github.com/users/navis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/navis/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/navis/spark","forks_url":"https://api.github.com/repos/navis/spark/forks","keys_url":"https://api.github.com/repos/navis/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/navis/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/navis/spark/teams","hooks_url":"https://api.github.com/repos/navis/spark/hooks","issue_events_url":"https://api.github.com/repos/navis/spark/issues/events{/number}","events_url":"https://api.github.com/repos/navis/spark/events","assignees_url":"https://api.github.com/repos/navis/spark/assignees{/user}","branches_url":"https://api.github.com/repos/navis/spark/branches{/branch}","tags_url":"https://api.github.com/repos/navis/spark/tags","blobs_url":"https://api.github.com/repos/navis/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/navis/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/navis/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/navis/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/navis/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/navis/spark/languages","stargazers_url":"https://api.github.com/repos/navis/spark/stargazers","contributors_url":"https://api.github.com/repos/navis/spark/contributors","subscribers_url":"https://api.github.com/repos/navis/spark/subscribers","subscription_url":"https://api.github.com/repos/navis/spark/subscription","commits_url":"https://api.github.com/repos/navis/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/navis/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/navis/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/navis/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/navis/spark/contents/{+path}","compare_url":"https://api.github.com/repos/navis/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/navis/spark/merges","archive_url":"https://api.github.com/repos/navis/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/navis/spark/downloads","issues_url":"https://api.github.com/repos/navis/spark/issues{/number}","pulls_url":"https://api.github.com/repos/navis/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/navis/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/navis/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/navis/spark/labels{/name}","releases_url":"https://api.github.com/repos/navis/spark/releases{/id}","created_at":"2015-05-29T06:08:05Z","updated_at":"2015-05-29T06:08:25Z","pushed_at":"2015-06-22T13:38:49Z","git_url":"git://github.com/navis/spark.git","ssh_url":"git@github.com:navis/spark.git","clone_url":"https://github.com/navis/spark.git","svn_url":"https://github.com/navis/spark","homepage":null,"size":109657,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"47c1d5629373566df9d12fdc4ceb22f38b869482","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-06-22T22:01:30Z","pushed_at":"2015-06-22T23:18:29Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":1498855,"stargazers_count":4483,"watchers_count":4483,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3952,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":350,"forks":3952,"open_issues":350,"watchers":4483,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/6810"},"html":{"href":"https://github.com/apache/spark/pull/6810"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/6810"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/6810/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/6810/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/6810/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/0a5bf170a1ed89344f2a57bd891154c17a6c44f8"}}}}