{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/49636533","id":49636533,"diff_hunk":"@@ -87,15 +91,62 @@ object ParquetReadBenchmark {\n               if (!record.isNullAt(0)) sum += record.getInt(0)\n             }\n             reader.close()\n-        }}\n+          }\n+        }\n+\n+        // Driving the parquet reader in batch mode directly.\n+        benchmark.addCase(\"ParquetReader(Batched)\") { num =>\n+          var sum = 0L\n+          files.map(_.asInstanceOf[String]).foreach { p =>\n+            val reader = new UnsafeRowParquetRecordReader\n+            try {\n+              reader.initialize(p, (\"id\" :: Nil).asJava)\n+              val batch = reader.resultBatch()\n+              val col = batch.column(0)\n+              while (reader.nextBatch()) {\n+                val numRows = batch.numRows()\n+                var i = 0\n+                while (i < numRows) {\n+                  if (!col.getIsNull(i)) sum += col.getInt(i)\n+                  i += 1\n+                }\n+              }\n+            } finally {\n+              reader.close()\n+            }\n+          }\n+        }\n+\n+        // Decoding in vectorized but having the reader return rows.\n+        benchmark.addCase(\"ParquetReader(Batch -> Row)\") { num =>\n+          var sum = 0L\n+          files.map(_.asInstanceOf[String]).foreach { p =>\n+            val reader = new UnsafeRowParquetRecordReader\n+            try {\n+              reader.initialize(p, (\"id\" :: Nil).asJava)\n+              val batch = reader.resultBatch()\n+              while (reader.nextBatch()) {\n+                val it = batch.rowIterator()\n+                while (it.hasNext) {\n+                  val record = it.next()\n+                  if (!record.isNullAt(0)) sum += record.getInt(0)\n+                }\n+              }\n+            } finally {\n+              reader.close()\n+            }\n+          }\n+        }\n \n         /*\n-          Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz\n-          Single Int Column Scan:      Avg Time(ms)    Avg Rate(M/s)  Relative Rate\n-          -------------------------------------------------------------------------\n-          SQL Parquet Reader                 1910.0            13.72         1.00 X\n-          SQL Parquet MR                     2330.0            11.25         0.82 X\n-          ParquetReader                      1252.6            20.93         1.52 X\n+        Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz\n+        Single Int Column Scan:            Avg Time(ms)    Avg Rate(M/s)  Relative Rate\n+        -------------------------------------------------------------------------------\n+        SQL Parquet Reader                       1682.6            15.58         1.00 X\n+        SQL Parquet MR                           2379.6            11.02         0.71 X\n+        ParquetReader                            1033.0            25.38         1.63 X","path":"sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetReadBenchmark.scala","position":90,"original_position":90,"commit_id":"10087b63a3009026b7d8bfda92d1b9b93f000f95","original_commit_id":"10087b63a3009026b7d8bfda92d1b9b93f000f95","user":{"login":"davies","id":40902,"avatar_url":"https://avatars.githubusercontent.com/u/40902?v=3","gravatar_id":"","url":"https://api.github.com/users/davies","html_url":"https://github.com/davies","followers_url":"https://api.github.com/users/davies/followers","following_url":"https://api.github.com/users/davies/following{/other_user}","gists_url":"https://api.github.com/users/davies/gists{/gist_id}","starred_url":"https://api.github.com/users/davies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davies/subscriptions","organizations_url":"https://api.github.com/users/davies/orgs","repos_url":"https://api.github.com/users/davies/repos","events_url":"https://api.github.com/users/davies/events{/privacy}","received_events_url":"https://api.github.com/users/davies/received_events","type":"User","site_admin":false},"body":"Should we separate these into two group, one use SQL, another one does not. It's not clear to compare SQL parquet Reader than ParquetReader(Batched) (should be SQL ParquetReader(Batched))","created_at":"2016-01-13T19:19:18Z","updated_at":"2016-01-13T19:19:18Z","html_url":"https://github.com/apache/spark/pull/10593#discussion_r49636533","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/10593","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/49636533"},"html":{"href":"https://github.com/apache/spark/pull/10593#discussion_r49636533"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/10593"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/10593","id":55064915,"html_url":"https://github.com/apache/spark/pull/10593","diff_url":"https://github.com/apache/spark/pull/10593.diff","patch_url":"https://github.com/apache/spark/pull/10593.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/10593","number":10593,"state":"open","locked":false,"title":"[SPARK-12644][SQL] Update parquet reader to be vectorized.","user":{"login":"nongli","id":242468,"avatar_url":"https://avatars.githubusercontent.com/u/242468?v=3","gravatar_id":"","url":"https://api.github.com/users/nongli","html_url":"https://github.com/nongli","followers_url":"https://api.github.com/users/nongli/followers","following_url":"https://api.github.com/users/nongli/following{/other_user}","gists_url":"https://api.github.com/users/nongli/gists{/gist_id}","starred_url":"https://api.github.com/users/nongli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nongli/subscriptions","organizations_url":"https://api.github.com/users/nongli/orgs","repos_url":"https://api.github.com/users/nongli/repos","events_url":"https://api.github.com/users/nongli/events{/privacy}","received_events_url":"https://api.github.com/users/nongli/received_events","type":"User","site_admin":false},"body":"This inlines a few of the Parquet decoders and adds vectorized APIs to support decoding in batch.\r\nThere are a few particulars in the Parquet encodings that make this much more efficient. In\r\nparticular, RLE encodings are very well suited for batch decoding. The Parquet 2.0 encodings are\r\nalso very suited for this.\r\n\r\nThis is a work in progress and does not affect the current execution. In subsequent patches, we will\r\nsupport more encodings and types before enabling this.\r\n\r\nSimple benchmarks indicate this can decode single ints about > 3x faster.","created_at":"2016-01-05T08:20:28Z","updated_at":"2016-01-13T19:19:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06ae14fe4c242f2c73ce7daaf8840fec5a6377eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/10593/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/10593/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/10593/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/10087b63a3009026b7d8bfda92d1b9b93f000f95","head":{"label":"nongli:spark-12644","ref":"spark-12644","sha":"10087b63a3009026b7d8bfda92d1b9b93f000f95","user":{"login":"nongli","id":242468,"avatar_url":"https://avatars.githubusercontent.com/u/242468?v=3","gravatar_id":"","url":"https://api.github.com/users/nongli","html_url":"https://github.com/nongli","followers_url":"https://api.github.com/users/nongli/followers","following_url":"https://api.github.com/users/nongli/following{/other_user}","gists_url":"https://api.github.com/users/nongli/gists{/gist_id}","starred_url":"https://api.github.com/users/nongli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nongli/subscriptions","organizations_url":"https://api.github.com/users/nongli/orgs","repos_url":"https://api.github.com/users/nongli/repos","events_url":"https://api.github.com/users/nongli/events{/privacy}","received_events_url":"https://api.github.com/users/nongli/received_events","type":"User","site_admin":false},"repo":{"id":30051398,"name":"spark","full_name":"nongli/spark","owner":{"login":"nongli","id":242468,"avatar_url":"https://avatars.githubusercontent.com/u/242468?v=3","gravatar_id":"","url":"https://api.github.com/users/nongli","html_url":"https://github.com/nongli","followers_url":"https://api.github.com/users/nongli/followers","following_url":"https://api.github.com/users/nongli/following{/other_user}","gists_url":"https://api.github.com/users/nongli/gists{/gist_id}","starred_url":"https://api.github.com/users/nongli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nongli/subscriptions","organizations_url":"https://api.github.com/users/nongli/orgs","repos_url":"https://api.github.com/users/nongli/repos","events_url":"https://api.github.com/users/nongli/events{/privacy}","received_events_url":"https://api.github.com/users/nongli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nongli/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/nongli/spark","forks_url":"https://api.github.com/repos/nongli/spark/forks","keys_url":"https://api.github.com/repos/nongli/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nongli/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nongli/spark/teams","hooks_url":"https://api.github.com/repos/nongli/spark/hooks","issue_events_url":"https://api.github.com/repos/nongli/spark/issues/events{/number}","events_url":"https://api.github.com/repos/nongli/spark/events","assignees_url":"https://api.github.com/repos/nongli/spark/assignees{/user}","branches_url":"https://api.github.com/repos/nongli/spark/branches{/branch}","tags_url":"https://api.github.com/repos/nongli/spark/tags","blobs_url":"https://api.github.com/repos/nongli/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nongli/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nongli/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/nongli/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nongli/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/nongli/spark/languages","stargazers_url":"https://api.github.com/repos/nongli/spark/stargazers","contributors_url":"https://api.github.com/repos/nongli/spark/contributors","subscribers_url":"https://api.github.com/repos/nongli/spark/subscribers","subscription_url":"https://api.github.com/repos/nongli/spark/subscription","commits_url":"https://api.github.com/repos/nongli/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/nongli/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/nongli/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/nongli/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/nongli/spark/contents/{+path}","compare_url":"https://api.github.com/repos/nongli/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nongli/spark/merges","archive_url":"https://api.github.com/repos/nongli/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nongli/spark/downloads","issues_url":"https://api.github.com/repos/nongli/spark/issues{/number}","pulls_url":"https://api.github.com/repos/nongli/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/nongli/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/nongli/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nongli/spark/labels{/name}","releases_url":"https://api.github.com/repos/nongli/spark/releases{/id}","created_at":"2015-01-30T02:01:12Z","updated_at":"2015-01-30T02:01:28Z","pushed_at":"2016-01-13T02:36:28Z","git_url":"git://github.com/nongli/spark.git","ssh_url":"git@github.com:nongli/spark.git","clone_url":"https://github.com/nongli/spark.git","svn_url":"https://github.com/nongli/spark","homepage":null,"size":132620,"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":"9247084962259ebbbac4c5a80a6ccb271776f019","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":"2016-01-13T18:54:04Z","pushed_at":"2016-01-13T18:56:14Z","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":399256,"stargazers_count":6986,"watchers_count":6986,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6412,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":348,"forks":6412,"open_issues":348,"watchers":6986,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/10593"},"html":{"href":"https://github.com/apache/spark/pull/10593"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/10593"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/10593/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/10593/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/10593/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/10087b63a3009026b7d8bfda92d1b9b93f000f95"}}}}