{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/35055968","id":35055968,"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.catalyst.expressions\n+\n+import org.apache.spark.SparkFunSuite\n+import org.apache.spark.sql.types._\n+\n+\n+class CollectionFunctionsSuite extends SparkFunSuite with ExpressionEvalHelper {\n+\n+  test(\"Array and Map Size\") {\n+    val a0 = Literal.create(Seq(1, 2, 3), ArrayType(IntegerType))\n+    val a1 = Literal.create(Seq[Integer](), ArrayType(IntegerType))\n+    val a2 = Literal.create(Seq(1, 2), ArrayType(IntegerType))\n+\n+    checkEvaluation(Size(a0), 3)\n+    checkEvaluation(Size(a1), 0)\n+    checkEvaluation(Size(a2), 2)\n+\n+    val m0 = Literal.create(Map(\"a\" -> \"a\", \"b\" -> \"b\"), MapType(StringType, StringType))\n+    val m1 = Literal.create(Map[String, String](), MapType(StringType, StringType))\n+    val m2 = Literal.create(Map(\"a\" -> \"a\"), MapType(StringType, StringType))\n+\n+    checkEvaluation(Size(m0), 2)\n+    checkEvaluation(Size(m1), 0)\n+    checkEvaluation(Size(m2), 1)","path":"sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionFunctionsSuite.scala","position":41,"original_position":41,"commit_id":"d88247cfe02a1cc7411ea1111dee31a79b8e44bc","original_commit_id":"d88247cfe02a1cc7411ea1111dee31a79b8e44bc","user":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2015-07-20T23:26:13Z","updated_at":"2015-07-20T23:26:13Z","html_url":"https://github.com/apache/spark/pull/7462#discussion_r35055968","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/7462","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/35055968"},"html":{"href":"https://github.com/apache/spark/pull/7462#discussion_r35055968"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/7462"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/7462","id":40207301,"html_url":"https://github.com/apache/spark/pull/7462","diff_url":"https://github.com/apache/spark/pull/7462.diff","patch_url":"https://github.com/apache/spark/pull/7462.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/7462","number":7462,"state":"open","locked":false,"title":"[SPARK-8230][SQL] Add array/map size method","user":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"body":"Pull Request for: https://issues.apache.org/jira/browse/SPARK-8230\r\n\r\nPrimary issue resolved is to implement array/map size for Spark SQL. Code is ready for review by a committer. Chen Hao is on the JIRA ticket, but I don't know his username on github, @rxin is also on JIRA ticket.\r\n\r\nThings to review:\r\n1. Where to put added functions namespace wise, they seem to be part of a few operations on collections which includes `sort_array` and `array_contains`. Hence the name given `collectionOperations.scala` and `_collection_functions` in python.\r\n2. In Python code, should it be in a `1.5.0` function array or in a collections array?\r\n3. Are there any missing methods on the `Size` case class? Looks like many of these functions have generated Java code, is that also needed in this case?\r\n4. Something else?","created_at":"2015-07-17T07:45:43Z","updated_at":"2015-07-20T23:26:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dafd6bc63790a972a2418ccae99e7c4e0381b058","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/7462/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/7462/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/7462/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/d88247cfe02a1cc7411ea1111dee31a79b8e44bc","head":{"label":"EntilZha:SPARK-8230","ref":"SPARK-8230","sha":"d88247cfe02a1cc7411ea1111dee31a79b8e44bc","user":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"repo":{"id":19327912,"name":"spark","full_name":"EntilZha/spark","owner":{"login":"EntilZha","id":1382460,"avatar_url":"https://avatars.githubusercontent.com/u/1382460?v=3","gravatar_id":"","url":"https://api.github.com/users/EntilZha","html_url":"https://github.com/EntilZha","followers_url":"https://api.github.com/users/EntilZha/followers","following_url":"https://api.github.com/users/EntilZha/following{/other_user}","gists_url":"https://api.github.com/users/EntilZha/gists{/gist_id}","starred_url":"https://api.github.com/users/EntilZha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EntilZha/subscriptions","organizations_url":"https://api.github.com/users/EntilZha/orgs","repos_url":"https://api.github.com/users/EntilZha/repos","events_url":"https://api.github.com/users/EntilZha/events{/privacy}","received_events_url":"https://api.github.com/users/EntilZha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/EntilZha/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/EntilZha/spark","forks_url":"https://api.github.com/repos/EntilZha/spark/forks","keys_url":"https://api.github.com/repos/EntilZha/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EntilZha/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EntilZha/spark/teams","hooks_url":"https://api.github.com/repos/EntilZha/spark/hooks","issue_events_url":"https://api.github.com/repos/EntilZha/spark/issues/events{/number}","events_url":"https://api.github.com/repos/EntilZha/spark/events","assignees_url":"https://api.github.com/repos/EntilZha/spark/assignees{/user}","branches_url":"https://api.github.com/repos/EntilZha/spark/branches{/branch}","tags_url":"https://api.github.com/repos/EntilZha/spark/tags","blobs_url":"https://api.github.com/repos/EntilZha/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EntilZha/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EntilZha/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/EntilZha/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EntilZha/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/EntilZha/spark/languages","stargazers_url":"https://api.github.com/repos/EntilZha/spark/stargazers","contributors_url":"https://api.github.com/repos/EntilZha/spark/contributors","subscribers_url":"https://api.github.com/repos/EntilZha/spark/subscribers","subscription_url":"https://api.github.com/repos/EntilZha/spark/subscription","commits_url":"https://api.github.com/repos/EntilZha/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/EntilZha/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/EntilZha/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/EntilZha/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/EntilZha/spark/contents/{+path}","compare_url":"https://api.github.com/repos/EntilZha/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EntilZha/spark/merges","archive_url":"https://api.github.com/repos/EntilZha/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EntilZha/spark/downloads","issues_url":"https://api.github.com/repos/EntilZha/spark/issues{/number}","pulls_url":"https://api.github.com/repos/EntilZha/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/EntilZha/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/EntilZha/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EntilZha/spark/labels{/name}","releases_url":"https://api.github.com/repos/EntilZha/spark/releases{/id}","created_at":"2014-04-30T21:31:22Z","updated_at":"2015-02-26T03:58:28Z","pushed_at":"2015-07-20T21:01:55Z","git_url":"git://github.com/EntilZha/spark.git","ssh_url":"git@github.com:EntilZha/spark.git","clone_url":"https://github.com/EntilZha/spark.git","svn_url":"https://github.com/EntilZha/spark","homepage":null,"size":106598,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"9f913c4fd6f0f223fd378e453d5b9a87beda1ac4","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-07-20T23:09:04Z","pushed_at":"2015-07-20T23:15:46Z","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":1544101,"stargazers_count":4807,"watchers_count":4807,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4303,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":342,"forks":4303,"open_issues":342,"watchers":4807,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/7462"},"html":{"href":"https://github.com/apache/spark/pull/7462"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/7462"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/7462/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/7462/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/7462/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/d88247cfe02a1cc7411ea1111dee31a79b8e44bc"}}}}