{"action":"created","comment":{"url":"https://api.github.com/repos/Teradata/presto/pulls/comments/80689395","pull_request_review_id":1720815,"id":80689395,"diff_hunk":"@@ -0,0 +1,210 @@\n+/*\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * 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+package com.facebook.presto.spi.block;\n+\n+import io.airlift.slice.Slice;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import static java.util.stream.Collectors.toList;\n+\n+public class MaskedBlock\n+        implements Block\n+{\n+    private Block block;\n+    private int[] positionsMapping;\n+    private final int mappingOffset;\n+    private final int mappingLength;\n+\n+    public MaskedBlock(Block block, int[] positionsMapping)\n+    {\n+        this(block, positionsMapping, 0, positionsMapping.length);\n+    }\n+\n+    public MaskedBlock(Block block, int[] positionsMapping, int mappingOffset, int mappingLength)\n+    {\n+        this.block = block;\n+        this.positionsMapping = positionsMapping;\n+        this.mappingOffset = mappingOffset;\n+        this.mappingLength = mappingLength;\n+    }\n+\n+    public Block getUnderlyingBlock()\n+    {\n+        return block;\n+    }\n+\n+    @Override\n+    public int getLength(int position)\n+    {\n+        return block.getLength(mapPosition(position));\n+    }\n+\n+    @Override\n+    public byte getByte(int position, int offset)\n+    {\n+        return block.getByte(mapPosition(position), offset);\n+    }\n+\n+    @Override\n+    public short getShort(int position, int offset)\n+    {\n+        return block.getShort(mapPosition(position), offset);\n+    }\n+\n+    @Override\n+    public int getInt(int position, int offset)\n+    {\n+        return block.getInt(mapPosition(position), offset);\n+    }\n+\n+    @Override\n+    public long getLong(int position, int offset)\n+    {\n+        return block.getLong(mapPosition(position), offset);\n+    }\n+\n+    @Override\n+    public Slice getSlice(int position, int offset, int length)\n+    {\n+        return block.getSlice(mapPosition(position), offset, length);\n+    }\n+\n+    @Override\n+    public <T> T getObject(int position, Class<T> clazz)\n+    {\n+        return block.getObject(mapPosition(position), clazz);\n+    }\n+\n+    @Override\n+    public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length)\n+    {\n+        return block.bytesEqual(mapPosition(position), offset, otherSlice, otherOffset, length);\n+    }\n+\n+    @Override\n+    public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)\n+    {\n+        return block.bytesCompare(mapPosition(position), offset, length, otherSlice, otherOffset, otherLength);\n+    }\n+\n+    @Override\n+    public void writeBytesTo(int position, int offset, int length, BlockBuilder blockBuilder)\n+    {\n+        block.writeBytesTo(mapPosition(position), offset, length, blockBuilder);\n+    }\n+\n+    @Override\n+    public void writePositionTo(int position, BlockBuilder blockBuilder)\n+    {\n+        block.writePositionTo(mapPosition(position), blockBuilder);\n+    }\n+\n+    @Override\n+    public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length)\n+    {\n+        return block.equals(mapPosition(position), offset, otherBlock, otherPosition, otherOffset, length);\n+    }\n+\n+    @Override\n+    public long hash(int position, int offset, int length)\n+    {\n+        return block.hash(mapPosition(position), offset, length);\n+    }\n+\n+    @Override\n+    public int compareTo(int leftPosition, int leftOffset, int leftLength, Block rightBlock, int rightPosition, int rightOffset, int rightLength)\n+    {\n+        return block.compareTo(mapPosition(leftPosition), leftOffset, leftLength, rightBlock, rightPosition, rightOffset, rightLength);\n+    }\n+\n+    @Override\n+    public Block getSingleValueBlock(int position)\n+    {\n+        return block.getSingleValueBlock(mapPosition(position));\n+    }\n+\n+    @Override\n+    public int getPositionCount()\n+    {\n+        return mappingLength;\n+    }\n+\n+    @Override\n+    public int getSizeInBytes()\n+    {\n+        return block.getSizeInBytes();\n+    }\n+\n+    @Override\n+    public int getRetainedSizeInBytes()\n+    {\n+        return block.getRetainedSizeInBytes();\n+    }\n+\n+    @Override\n+    public BlockEncoding getEncoding()\n+    {\n+        return new MaskedBlockEncoding(block.getEncoding());\n+    }\n+\n+    @Override\n+    public Block copyPositions(List<Integer> positions)\n+    {\n+        List<Integer> mappedPositions = positions.stream().map(this::mapPosition).collect(toList());\n+        return block.copyPositions(mappedPositions);\n+    }\n+\n+    @Override\n+    public Block getRegion(int positionOffset, int length)\n+    {\n+        return new MaskedBlock(block, positionsMapping, mappingOffset + positionOffset, length);\n+    }\n+\n+    @Override\n+    public Block copyRegion(int startPosition, int length)\n+    {\n+        List<Integer> mappedPositions = new ArrayList<>(length);\n+        for (int position = startPosition; position < startPosition + length; position++) {\n+            mappedPositions.add(mapPosition(position));\n+        }\n+        return block.copyPositions(mappedPositions);\n+    }\n+\n+    @Override\n+    public boolean isNull(int position)\n+    {\n+        return block.isNull(mapPosition(position));\n+    }\n+\n+    @Override\n+    public void assureLoaded()\n+    {\n+        block.assureLoaded();\n+    }\n+\n+    private int mapPosition(int position)\n+    {\n+        checkReadablePosition(position);\n+        return positionsMapping[position + mappingOffset];\n+    }\n+\n+    private void checkReadablePosition(int position)\n+    {\n+        if (position < 0 || position >= getPositionCount()) {","path":"presto-spi/src/main/java/com/facebook/presto/spi/block/MaskedBlock.java","position":206,"original_position":206,"commit_id":"b7a77e0be3f5dff9f6e4ae9887e873f1277c85fe","original_commit_id":"078ae3f0704a159918f629d182624e0df2a14529","user":{"login":"pnowojski","id":8957547,"avatar_url":"https://avatars.githubusercontent.com/u/8957547?v=3","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"body":"this one is more generic","created_at":"2016-09-27T13:20:43Z","updated_at":"2016-09-27T13:28:37Z","html_url":"https://github.com/Teradata/presto/pull/356#discussion_r80689395","pull_request_url":"https://api.github.com/repos/Teradata/presto/pulls/356","_links":{"self":{"href":"https://api.github.com/repos/Teradata/presto/pulls/comments/80689395"},"html":{"href":"https://github.com/Teradata/presto/pull/356#discussion_r80689395"},"pull_request":{"href":"https://api.github.com/repos/Teradata/presto/pulls/356"}}},"pull_request":{"url":"https://api.github.com/repos/Teradata/presto/pulls/356","id":86466332,"html_url":"https://github.com/Teradata/presto/pull/356","diff_url":"https://github.com/Teradata/presto/pull/356.diff","patch_url":"https://github.com/Teradata/presto/pull/356.patch","issue_url":"https://api.github.com/repos/Teradata/presto/issues/356","number":356,"state":"open","locked":false,"title":"Spill join","user":{"login":"pnowojski","id":8957547,"avatar_url":"https://avatars.githubusercontent.com/u/8957547?v=3","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"body":"First two commits are not part of this pull request (dependencies from other pull requests)\r\n\r\nLast commit disables tests, that shows a bug from spill-v2 branch (previously not visible because of different session properties used in this test)\r\n\r\nLookJoinOperator needs refactoring.","created_at":"2016-09-23T07:35:35Z","updated_at":"2016-09-27T13:28:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9ad042c3b2d2a54108b77f666e7e01ab4821223c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Teradata/presto/pulls/356/commits","review_comments_url":"https://api.github.com/repos/Teradata/presto/pulls/356/comments","review_comment_url":"https://api.github.com/repos/Teradata/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Teradata/presto/issues/356/comments","statuses_url":"https://api.github.com/repos/Teradata/presto/statuses/b7a77e0be3f5dff9f6e4ae9887e873f1277c85fe","head":{"label":"pnowojski:spill-join","ref":"spill-join","sha":"b7a77e0be3f5dff9f6e4ae9887e873f1277c85fe","user":{"login":"pnowojski","id":8957547,"avatar_url":"https://avatars.githubusercontent.com/u/8957547?v=3","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"repo":{"id":33667461,"name":"presto","full_name":"pnowojski/presto","owner":{"login":"pnowojski","id":8957547,"avatar_url":"https://avatars.githubusercontent.com/u/8957547?v=3","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pnowojski/presto","description":"Distributed SQL query engine for running interactive analytic queries against big data sources.","fork":true,"url":"https://api.github.com/repos/pnowojski/presto","forks_url":"https://api.github.com/repos/pnowojski/presto/forks","keys_url":"https://api.github.com/repos/pnowojski/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pnowojski/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pnowojski/presto/teams","hooks_url":"https://api.github.com/repos/pnowojski/presto/hooks","issue_events_url":"https://api.github.com/repos/pnowojski/presto/issues/events{/number}","events_url":"https://api.github.com/repos/pnowojski/presto/events","assignees_url":"https://api.github.com/repos/pnowojski/presto/assignees{/user}","branches_url":"https://api.github.com/repos/pnowojski/presto/branches{/branch}","tags_url":"https://api.github.com/repos/pnowojski/presto/tags","blobs_url":"https://api.github.com/repos/pnowojski/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pnowojski/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pnowojski/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/pnowojski/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pnowojski/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/pnowojski/presto/languages","stargazers_url":"https://api.github.com/repos/pnowojski/presto/stargazers","contributors_url":"https://api.github.com/repos/pnowojski/presto/contributors","subscribers_url":"https://api.github.com/repos/pnowojski/presto/subscribers","subscription_url":"https://api.github.com/repos/pnowojski/presto/subscription","commits_url":"https://api.github.com/repos/pnowojski/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/pnowojski/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/pnowojski/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/pnowojski/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/pnowojski/presto/contents/{+path}","compare_url":"https://api.github.com/repos/pnowojski/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pnowojski/presto/merges","archive_url":"https://api.github.com/repos/pnowojski/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pnowojski/presto/downloads","issues_url":"https://api.github.com/repos/pnowojski/presto/issues{/number}","pulls_url":"https://api.github.com/repos/pnowojski/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/pnowojski/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/pnowojski/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pnowojski/presto/labels{/name}","releases_url":"https://api.github.com/repos/pnowojski/presto/releases{/id}","deployments_url":"https://api.github.com/repos/pnowojski/presto/deployments","created_at":"2015-04-09T12:25:40Z","updated_at":"2016-03-18T00:24:48Z","pushed_at":"2016-09-27T12:04:09Z","git_url":"git://github.com/pnowojski/presto.git","ssh_url":"git@github.com:pnowojski/presto.git","clone_url":"https://github.com/pnowojski/presto.git","svn_url":"https://github.com/pnowojski/presto","homepage":"https://prestodb.io","size":63388,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"Teradata:spill-v2","ref":"spill-v2","sha":"bc4f7a300076cb33eaafd04f489896a61b534782","user":{"login":"Teradata","id":1615979,"avatar_url":"https://avatars.githubusercontent.com/u/1615979?v=3","gravatar_id":"","url":"https://api.github.com/users/Teradata","html_url":"https://github.com/Teradata","followers_url":"https://api.github.com/users/Teradata/followers","following_url":"https://api.github.com/users/Teradata/following{/other_user}","gists_url":"https://api.github.com/users/Teradata/gists{/gist_id}","starred_url":"https://api.github.com/users/Teradata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Teradata/subscriptions","organizations_url":"https://api.github.com/users/Teradata/orgs","repos_url":"https://api.github.com/users/Teradata/repos","events_url":"https://api.github.com/users/Teradata/events{/privacy}","received_events_url":"https://api.github.com/users/Teradata/received_events","type":"Organization","site_admin":false},"repo":{"id":36903368,"name":"presto","full_name":"Teradata/presto","owner":{"login":"Teradata","id":1615979,"avatar_url":"https://avatars.githubusercontent.com/u/1615979?v=3","gravatar_id":"","url":"https://api.github.com/users/Teradata","html_url":"https://github.com/Teradata","followers_url":"https://api.github.com/users/Teradata/followers","following_url":"https://api.github.com/users/Teradata/following{/other_user}","gists_url":"https://api.github.com/users/Teradata/gists{/gist_id}","starred_url":"https://api.github.com/users/Teradata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Teradata/subscriptions","organizations_url":"https://api.github.com/users/Teradata/orgs","repos_url":"https://api.github.com/users/Teradata/repos","events_url":"https://api.github.com/users/Teradata/events{/privacy}","received_events_url":"https://api.github.com/users/Teradata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Teradata/presto","description":"Teradata Distribution of Presto -- A Distributed SQL Query Engine for Big Data","fork":true,"url":"https://api.github.com/repos/Teradata/presto","forks_url":"https://api.github.com/repos/Teradata/presto/forks","keys_url":"https://api.github.com/repos/Teradata/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Teradata/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Teradata/presto/teams","hooks_url":"https://api.github.com/repos/Teradata/presto/hooks","issue_events_url":"https://api.github.com/repos/Teradata/presto/issues/events{/number}","events_url":"https://api.github.com/repos/Teradata/presto/events","assignees_url":"https://api.github.com/repos/Teradata/presto/assignees{/user}","branches_url":"https://api.github.com/repos/Teradata/presto/branches{/branch}","tags_url":"https://api.github.com/repos/Teradata/presto/tags","blobs_url":"https://api.github.com/repos/Teradata/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Teradata/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Teradata/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/Teradata/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Teradata/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/Teradata/presto/languages","stargazers_url":"https://api.github.com/repos/Teradata/presto/stargazers","contributors_url":"https://api.github.com/repos/Teradata/presto/contributors","subscribers_url":"https://api.github.com/repos/Teradata/presto/subscribers","subscription_url":"https://api.github.com/repos/Teradata/presto/subscription","commits_url":"https://api.github.com/repos/Teradata/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/Teradata/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/Teradata/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/Teradata/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/Teradata/presto/contents/{+path}","compare_url":"https://api.github.com/repos/Teradata/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Teradata/presto/merges","archive_url":"https://api.github.com/repos/Teradata/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Teradata/presto/downloads","issues_url":"https://api.github.com/repos/Teradata/presto/issues{/number}","pulls_url":"https://api.github.com/repos/Teradata/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/Teradata/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/Teradata/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Teradata/presto/labels{/name}","releases_url":"https://api.github.com/repos/Teradata/presto/releases{/id}","deployments_url":"https://api.github.com/repos/Teradata/presto/deployments","created_at":"2015-06-05T00:38:37Z","updated_at":"2016-08-29T16:52:50Z","pushed_at":"2016-09-27T12:22:36Z","git_url":"git://github.com/Teradata/presto.git","ssh_url":"git@github.com:Teradata/presto.git","clone_url":"https://github.com/Teradata/presto.git","svn_url":"https://github.com/Teradata/presto","homepage":"http://www.teradata.com/presto","size":160675,"stargazers_count":56,"watchers_count":56,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":11,"mirror_url":null,"open_issues_count":15,"forks":11,"open_issues":15,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Teradata/presto/pulls/356"},"html":{"href":"https://github.com/Teradata/presto/pull/356"},"issue":{"href":"https://api.github.com/repos/Teradata/presto/issues/356"},"comments":{"href":"https://api.github.com/repos/Teradata/presto/issues/356/comments"},"review_comments":{"href":"https://api.github.com/repos/Teradata/presto/pulls/356/comments"},"review_comment":{"href":"https://api.github.com/repos/Teradata/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Teradata/presto/pulls/356/commits"},"statuses":{"href":"https://api.github.com/repos/Teradata/presto/statuses/b7a77e0be3f5dff9f6e4ae9887e873f1277c85fe"}}}}
{"actor":{"display_login":"pnowojski"}}