{"action":"created","comment":{"url":"https://api.github.com/repos/hyrise/hyrise/pulls/comments/169298072","pull_request_review_id":97799177,"id":169298072,"diff_hunk":"@@ -80,8 +82,25 @@ class ColumnIterable {\n     });\n   }\n \n+  /**\n+   * By default, iterables may call functors passed to with_iterators()\n+   * several times with iterators to different parts of the column.\n+   * Call require_single_functor_call() if your code requires a single call.\n+   */\n+  void require_single_functor_call() { _single_call_required = true; }","path":"src/lib/storage/column_iterables.hpp","position":17,"original_position":17,"commit_id":"ee1d70795342a92182335be70c66e4122f47e3e0","original_commit_id":"ee1d70795342a92182335be70c66e4122f47e3e0","user":{"login":"mjendruk","id":2190123,"avatar_url":"https://avatars0.githubusercontent.com/u/2190123?v=4","gravatar_id":"","url":"https://api.github.com/users/mjendruk","html_url":"https://github.com/mjendruk","followers_url":"https://api.github.com/users/mjendruk/followers","following_url":"https://api.github.com/users/mjendruk/following{/other_user}","gists_url":"https://api.github.com/users/mjendruk/gists{/gist_id}","starred_url":"https://api.github.com/users/mjendruk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjendruk/subscriptions","organizations_url":"https://api.github.com/users/mjendruk/orgs","repos_url":"https://api.github.com/users/mjendruk/repos","events_url":"https://api.github.com/users/mjendruk/events{/privacy}","received_events_url":"https://api.github.com/users/mjendruk/received_events","type":"User","site_admin":false},"body":"It is used here: https://github.com/hyrise/hyrise/blob/ee1d70795342a92182335be70c66e4122f47e3e0/src/lib/storage/reference_column/reference_column_iterable.hpp","created_at":"2018-02-20T12:03:51Z","updated_at":"2018-02-20T12:03:51Z","html_url":"https://github.com/hyrise/hyrise/pull/707#discussion_r169298072","pull_request_url":"https://api.github.com/repos/hyrise/hyrise/pulls/707","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/hyrise/hyrise/pulls/comments/169298072"},"html":{"href":"https://github.com/hyrise/hyrise/pull/707#discussion_r169298072"},"pull_request":{"href":"https://api.github.com/repos/hyrise/hyrise/pulls/707"}},"in_reply_to_id":169279516},"pull_request":{"url":"https://api.github.com/repos/hyrise/hyrise/pulls/707","id":169756266,"html_url":"https://github.com/hyrise/hyrise/pull/707","diff_url":"https://github.com/hyrise/hyrise/pull/707.diff","patch_url":"https://github.com/hyrise/hyrise/pull/707.patch","issue_url":"https://api.github.com/repos/hyrise/hyrise/issues/707","number":707,"state":"open","locked":false,"title":"Add PosListType and optimise Iterables and TableScan","user":{"login":"mjendruk","id":2190123,"avatar_url":"https://avatars0.githubusercontent.com/u/2190123?v=4","gravatar_id":"","url":"https://api.github.com/users/mjendruk","html_url":"https://github.com/mjendruk","followers_url":"https://api.github.com/users/mjendruk/followers","following_url":"https://api.github.com/users/mjendruk/following{/other_user}","gists_url":"https://api.github.com/users/mjendruk/gists{/gist_id}","starred_url":"https://api.github.com/users/mjendruk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjendruk/subscriptions","organizations_url":"https://api.github.com/users/mjendruk/orgs","repos_url":"https://api.github.com/users/mjendruk/repos","events_url":"https://api.github.com/users/mjendruk/events{/privacy}","received_events_url":"https://api.github.com/users/mjendruk/received_events","type":"User","site_admin":false},"body":"This PR adds `PosListType`, which is used to implement certain optimisations on iterables. The biggest change is though that I replaced the old `ChunkOffsetsList` with `PosList` in iterables. Before, a `PosList` had to be converted into a `ChunkOffsetsList` in order to access elements in a column randomly. This is not necessary anymore. \r\n\r\n### Example\r\n\r\n`PosList` of a `ReferenceColumn` (Index, `ChunkID`)\r\n\r\n| 0    | 1    | 2    | 3    | 4    | 5    | 6    | 7    | 8    | 9    |\r\n| --- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |\r\n| 2   | 2 | 1 | 1 | 1 | 2 | 2 | 3 | 3 | 3 |\r\n\r\nPreviously, the table scan split the `PosList`  into three parts, one for each `ChunkID`. It also added the index – i.e., the position within the `ReferenceColumn` – to every element. This was necessary because the `ReferenceColumn` would be traversed out of order so we needed to store the actual indices. As a result, each underlying column was only visited once. The problem was that even if the `PosList` contained only `RowID`s from a single chunk, the `PosList` still had to be traversed in advance.\r\n\r\nNow, the table scan doesn’t convert the `PosList` anymore. Instead, two `PosListIterator`s are passed into the iterable. If the `ReferenceColumn` references only one chunk, this will be `pos_list.cbegin()` and `pos_list.cend()`. Otherwise the `PosList` is traversed looking for runs of the same `ChunkID`. Everytime the `ChunkID` changes, the previous run's underlying column is visited. So four visits for the example. `ChunkID` 2 is visited twice.\r\n\r\n__Question__: What is more likely: to have a `PosList` more or less sorted by `ChunkID` or the worst case, an alternating `PosList` switching from one `ChunkID` to the other?\r\n\r\n\r\n### Benchmark\r\n\r\nI ran the TPC-H benchmark. The biggest improvement could be seen for `#6`. The new implementation is 18.15% faster.\r\n\r\n```json\r\n{\r\n  \"optimised\": {\r\n    \"cpu_time\": 324180,\r\n    \"items_per_second\": 3084.70458984375,\r\n    \"iterations\": 1000,\r\n    \"name\": \"TPC-H 6\",\r\n    \"real_time\": 324180,\r\n    \"time_unit\": \"ns\"\r\n  },\r\n  \"master\": {\r\n    \"cpu_time\": 396090,\r\n    \"items_per_second\": 2524.67846679688,\r\n    \"iterations\": 1000,\r\n    \"name\": \"TPC-H 6\",\r\n    \"real_time\": 396090,\r\n    \"time_unit\": \"ns\"\r\n  }\r\n}\r\n```\r\n\r\nThe other benchmarks didn’t really change.  They were also much much slower. As a comparison, see the results below for `#7`. It seems there is lots of room for improvement ;)\r\n```json\r\n{\r\n  \"optimised\": {\r\n    \"cpu_time\": 908501324,\r\n    \"items_per_second\": 1.10071384906769,\r\n    \"iterations\": 23,\r\n    \"name\": \"TPC-H 7\",\r\n    \"real_time\": 908501324,\r\n    \"time_unit\": \"ns\"\r\n  },\r\n  \"master\": {\r\n    \"cpu_time\": 916567183,\r\n    \"items_per_second\": 1.09102749824524,\r\n    \"iterations\": 22,\r\n    \"name\": \"TPC-H 7\",\r\n    \"real_time\": 916567183,\r\n    \"time_unit\": \"ns\"\r\n  }\r\n}\r\n```\r\n\r\n### Todo\r\n- [ ] clean up\r\n- [ ] remove old code","created_at":"2018-02-17T00:31:26Z","updated_at":"2018-02-20T12:03:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40062c5cb09ae7e2d97aca96b15a0babfe0ed2d7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":604249449,"url":"https://api.github.com/repos/hyrise/hyrise/labels/WIP","name":"WIP","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/hyrise/hyrise/pulls/707/commits","review_comments_url":"https://api.github.com/repos/hyrise/hyrise/pulls/707/comments","review_comment_url":"https://api.github.com/repos/hyrise/hyrise/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hyrise/hyrise/issues/707/comments","statuses_url":"https://api.github.com/repos/hyrise/hyrise/statuses/ee1d70795342a92182335be70c66e4122f47e3e0","head":{"label":"hyrise:max/add_pos_list_type","ref":"max/add_pos_list_type","sha":"ee1d70795342a92182335be70c66e4122f47e3e0","user":{"login":"hyrise","id":3465095,"avatar_url":"https://avatars2.githubusercontent.com/u/3465095?v=4","gravatar_id":"","url":"https://api.github.com/users/hyrise","html_url":"https://github.com/hyrise","followers_url":"https://api.github.com/users/hyrise/followers","following_url":"https://api.github.com/users/hyrise/following{/other_user}","gists_url":"https://api.github.com/users/hyrise/gists{/gist_id}","starred_url":"https://api.github.com/users/hyrise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyrise/subscriptions","organizations_url":"https://api.github.com/users/hyrise/orgs","repos_url":"https://api.github.com/users/hyrise/repos","events_url":"https://api.github.com/users/hyrise/events{/privacy}","received_events_url":"https://api.github.com/users/hyrise/received_events","type":"Organization","site_admin":false},"repo":{"id":87414843,"name":"hyrise","full_name":"hyrise/hyrise","owner":{"login":"hyrise","id":3465095,"avatar_url":"https://avatars2.githubusercontent.com/u/3465095?v=4","gravatar_id":"","url":"https://api.github.com/users/hyrise","html_url":"https://github.com/hyrise","followers_url":"https://api.github.com/users/hyrise/followers","following_url":"https://api.github.com/users/hyrise/following{/other_user}","gists_url":"https://api.github.com/users/hyrise/gists{/gist_id}","starred_url":"https://api.github.com/users/hyrise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyrise/subscriptions","organizations_url":"https://api.github.com/users/hyrise/orgs","repos_url":"https://api.github.com/users/hyrise/repos","events_url":"https://api.github.com/users/hyrise/events{/privacy}","received_events_url":"https://api.github.com/users/hyrise/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyrise/hyrise","description":"A research in-memory database.","fork":false,"url":"https://api.github.com/repos/hyrise/hyrise","forks_url":"https://api.github.com/repos/hyrise/hyrise/forks","keys_url":"https://api.github.com/repos/hyrise/hyrise/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyrise/hyrise/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyrise/hyrise/teams","hooks_url":"https://api.github.com/repos/hyrise/hyrise/hooks","issue_events_url":"https://api.github.com/repos/hyrise/hyrise/issues/events{/number}","events_url":"https://api.github.com/repos/hyrise/hyrise/events","assignees_url":"https://api.github.com/repos/hyrise/hyrise/assignees{/user}","branches_url":"https://api.github.com/repos/hyrise/hyrise/branches{/branch}","tags_url":"https://api.github.com/repos/hyrise/hyrise/tags","blobs_url":"https://api.github.com/repos/hyrise/hyrise/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyrise/hyrise/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyrise/hyrise/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyrise/hyrise/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyrise/hyrise/statuses/{sha}","languages_url":"https://api.github.com/repos/hyrise/hyrise/languages","stargazers_url":"https://api.github.com/repos/hyrise/hyrise/stargazers","contributors_url":"https://api.github.com/repos/hyrise/hyrise/contributors","subscribers_url":"https://api.github.com/repos/hyrise/hyrise/subscribers","subscription_url":"https://api.github.com/repos/hyrise/hyrise/subscription","commits_url":"https://api.github.com/repos/hyrise/hyrise/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyrise/hyrise/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyrise/hyrise/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyrise/hyrise/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyrise/hyrise/contents/{+path}","compare_url":"https://api.github.com/repos/hyrise/hyrise/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyrise/hyrise/merges","archive_url":"https://api.github.com/repos/hyrise/hyrise/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyrise/hyrise/downloads","issues_url":"https://api.github.com/repos/hyrise/hyrise/issues{/number}","pulls_url":"https://api.github.com/repos/hyrise/hyrise/pulls{/number}","milestones_url":"https://api.github.com/repos/hyrise/hyrise/milestones{/number}","notifications_url":"https://api.github.com/repos/hyrise/hyrise/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyrise/hyrise/labels{/name}","releases_url":"https://api.github.com/repos/hyrise/hyrise/releases{/id}","deployments_url":"https://api.github.com/repos/hyrise/hyrise/deployments","created_at":"2017-04-06T10:03:31Z","updated_at":"2018-02-02T09:29:02Z","pushed_at":"2018-02-20T12:03:02Z","git_url":"git://github.com/hyrise/hyrise.git","ssh_url":"git@github.com:hyrise/hyrise.git","clone_url":"https://github.com/hyrise/hyrise.git","svn_url":"https://github.com/hyrise/hyrise","homepage":"https://hpi.de/plattner/projects/hyrise.html","size":11833,"stargazers_count":57,"watchers_count":57,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":71,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":19,"open_issues":71,"watchers":57,"default_branch":"master"}},"base":{"label":"hyrise:max/iterable_type_erasure","ref":"max/iterable_type_erasure","sha":"af80d95e0dbe1deecf6b453254683e33cc038dac","user":{"login":"hyrise","id":3465095,"avatar_url":"https://avatars2.githubusercontent.com/u/3465095?v=4","gravatar_id":"","url":"https://api.github.com/users/hyrise","html_url":"https://github.com/hyrise","followers_url":"https://api.github.com/users/hyrise/followers","following_url":"https://api.github.com/users/hyrise/following{/other_user}","gists_url":"https://api.github.com/users/hyrise/gists{/gist_id}","starred_url":"https://api.github.com/users/hyrise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyrise/subscriptions","organizations_url":"https://api.github.com/users/hyrise/orgs","repos_url":"https://api.github.com/users/hyrise/repos","events_url":"https://api.github.com/users/hyrise/events{/privacy}","received_events_url":"https://api.github.com/users/hyrise/received_events","type":"Organization","site_admin":false},"repo":{"id":87414843,"name":"hyrise","full_name":"hyrise/hyrise","owner":{"login":"hyrise","id":3465095,"avatar_url":"https://avatars2.githubusercontent.com/u/3465095?v=4","gravatar_id":"","url":"https://api.github.com/users/hyrise","html_url":"https://github.com/hyrise","followers_url":"https://api.github.com/users/hyrise/followers","following_url":"https://api.github.com/users/hyrise/following{/other_user}","gists_url":"https://api.github.com/users/hyrise/gists{/gist_id}","starred_url":"https://api.github.com/users/hyrise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyrise/subscriptions","organizations_url":"https://api.github.com/users/hyrise/orgs","repos_url":"https://api.github.com/users/hyrise/repos","events_url":"https://api.github.com/users/hyrise/events{/privacy}","received_events_url":"https://api.github.com/users/hyrise/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hyrise/hyrise","description":"A research in-memory database.","fork":false,"url":"https://api.github.com/repos/hyrise/hyrise","forks_url":"https://api.github.com/repos/hyrise/hyrise/forks","keys_url":"https://api.github.com/repos/hyrise/hyrise/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hyrise/hyrise/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hyrise/hyrise/teams","hooks_url":"https://api.github.com/repos/hyrise/hyrise/hooks","issue_events_url":"https://api.github.com/repos/hyrise/hyrise/issues/events{/number}","events_url":"https://api.github.com/repos/hyrise/hyrise/events","assignees_url":"https://api.github.com/repos/hyrise/hyrise/assignees{/user}","branches_url":"https://api.github.com/repos/hyrise/hyrise/branches{/branch}","tags_url":"https://api.github.com/repos/hyrise/hyrise/tags","blobs_url":"https://api.github.com/repos/hyrise/hyrise/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hyrise/hyrise/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hyrise/hyrise/git/refs{/sha}","trees_url":"https://api.github.com/repos/hyrise/hyrise/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hyrise/hyrise/statuses/{sha}","languages_url":"https://api.github.com/repos/hyrise/hyrise/languages","stargazers_url":"https://api.github.com/repos/hyrise/hyrise/stargazers","contributors_url":"https://api.github.com/repos/hyrise/hyrise/contributors","subscribers_url":"https://api.github.com/repos/hyrise/hyrise/subscribers","subscription_url":"https://api.github.com/repos/hyrise/hyrise/subscription","commits_url":"https://api.github.com/repos/hyrise/hyrise/commits{/sha}","git_commits_url":"https://api.github.com/repos/hyrise/hyrise/git/commits{/sha}","comments_url":"https://api.github.com/repos/hyrise/hyrise/comments{/number}","issue_comment_url":"https://api.github.com/repos/hyrise/hyrise/issues/comments{/number}","contents_url":"https://api.github.com/repos/hyrise/hyrise/contents/{+path}","compare_url":"https://api.github.com/repos/hyrise/hyrise/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hyrise/hyrise/merges","archive_url":"https://api.github.com/repos/hyrise/hyrise/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hyrise/hyrise/downloads","issues_url":"https://api.github.com/repos/hyrise/hyrise/issues{/number}","pulls_url":"https://api.github.com/repos/hyrise/hyrise/pulls{/number}","milestones_url":"https://api.github.com/repos/hyrise/hyrise/milestones{/number}","notifications_url":"https://api.github.com/repos/hyrise/hyrise/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hyrise/hyrise/labels{/name}","releases_url":"https://api.github.com/repos/hyrise/hyrise/releases{/id}","deployments_url":"https://api.github.com/repos/hyrise/hyrise/deployments","created_at":"2017-04-06T10:03:31Z","updated_at":"2018-02-02T09:29:02Z","pushed_at":"2018-02-20T12:03:02Z","git_url":"git://github.com/hyrise/hyrise.git","ssh_url":"git@github.com:hyrise/hyrise.git","clone_url":"https://github.com/hyrise/hyrise.git","svn_url":"https://github.com/hyrise/hyrise","homepage":"https://hpi.de/plattner/projects/hyrise.html","size":11833,"stargazers_count":57,"watchers_count":57,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":71,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":19,"open_issues":71,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hyrise/hyrise/pulls/707"},"html":{"href":"https://github.com/hyrise/hyrise/pull/707"},"issue":{"href":"https://api.github.com/repos/hyrise/hyrise/issues/707"},"comments":{"href":"https://api.github.com/repos/hyrise/hyrise/issues/707/comments"},"review_comments":{"href":"https://api.github.com/repos/hyrise/hyrise/pulls/707/comments"},"review_comment":{"href":"https://api.github.com/repos/hyrise/hyrise/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hyrise/hyrise/pulls/707/commits"},"statuses":{"href":"https://api.github.com/repos/hyrise/hyrise/statuses/ee1d70795342a92182335be70c66e4122f47e3e0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mjendruk"}}