{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto/pulls/comments/129166600","pull_request_review_id":51911626,"id":129166600,"diff_hunk":"@@ -0,0 +1,45 @@\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.matching;\n+\n+import java.util.Optional;\n+import java.util.function.Function;\n+\n+public interface Property<F, T>\n+{\n+    <R> PropertyPattern<F, R> matching(Pattern<R> pattern);\n+\n+    static <F, T> Property<F, T> property(Function<F, T> property)\n+    {\n+        return optionalProperty(source -> Optional.of(property.apply(source)));\n+    }\n+\n+    static <F, T> Property<F, T> optionalProperty(Function<F, Optional<T>> property)\n+    {\n+        return new Property<F, T>()\n+        {\n+            @Override\n+            public <R> PropertyPattern<F, R> matching(Pattern<R> pattern)\n+            {\n+                return PropertyPattern.of(property, pattern);\n+            }\n+        };\n+    }\n+\n+    default PropertyPattern<F, T> capturedAs(Capture<T> capture)","path":"presto-matching/src/main/java/com/facebook/presto/matching/Property.java","position":40,"original_position":40,"commit_id":"654f5896d1b664a364ca4f830647b538f0f53069","original_commit_id":"4cea1429b72829c7568a57188c93d12718f7a77a","user":{"login":"ArturGajowy","id":460141,"avatar_url":"https://avatars1.githubusercontent.com/u/460141?v=4","gravatar_id":"","url":"https://api.github.com/users/ArturGajowy","html_url":"https://github.com/ArturGajowy","followers_url":"https://api.github.com/users/ArturGajowy/followers","following_url":"https://api.github.com/users/ArturGajowy/following{/other_user}","gists_url":"https://api.github.com/users/ArturGajowy/gists{/gist_id}","starred_url":"https://api.github.com/users/ArturGajowy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArturGajowy/subscriptions","organizations_url":"https://api.github.com/users/ArturGajowy/orgs","repos_url":"https://api.github.com/users/ArturGajowy/repos","events_url":"https://api.github.com/users/ArturGajowy/events{/privacy}","received_events_url":"https://api.github.com/users/ArturGajowy/received_events","type":"User","site_admin":false},"body":"I did `property`, `optionalProperty`, `matching`, `capturedAs` to reflect the factories - abstract instance methods - instance methods order","created_at":"2017-07-24T22:04:37Z","updated_at":"2017-07-24T22:04:37Z","html_url":"https://github.com/prestodb/presto/pull/8568#discussion_r129166600","pull_request_url":"https://api.github.com/repos/prestodb/presto/pulls/8568","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments/129166600"},"html":{"href":"https://github.com/prestodb/presto/pull/8568#discussion_r129166600"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto/pulls/8568"}}},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/8568","id":131722895,"html_url":"https://github.com/prestodb/presto/pull/8568","diff_url":"https://github.com/prestodb/presto/pull/8568.diff","patch_url":"https://github.com/prestodb/presto/pull/8568.patch","issue_url":"https://api.github.com/repos/prestodb/presto/issues/8568","number":8568,"state":"open","locked":false,"title":"New pattern matching framework and its usage in iterative optimizer","user":{"login":"ArturGajowy","id":460141,"avatar_url":"https://avatars1.githubusercontent.com/u/460141?v=4","gravatar_id":"","url":"https://api.github.com/users/ArturGajowy","html_url":"https://github.com/ArturGajowy","followers_url":"https://api.github.com/users/ArturGajowy/followers","following_url":"https://api.github.com/users/ArturGajowy/following{/other_user}","gists_url":"https://api.github.com/users/ArturGajowy/gists{/gist_id}","starred_url":"https://api.github.com/users/ArturGajowy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArturGajowy/subscriptions","organizations_url":"https://api.github.com/users/ArturGajowy/orgs","repos_url":"https://api.github.com/users/ArturGajowy/repos","events_url":"https://api.github.com/users/ArturGajowy/events{/privacy}","received_events_url":"https://api.github.com/users/ArturGajowy/received_events","type":"User","site_admin":false},"body":"This introduces the new matcher based on the [matchmaker.rocks](http://matchmaker.rocks) prototype.\r\n\r\nImprovements include:\r\n - Pattern now carries its return type, allowing for no casts re-asserting the root node type in rule\r\n - Patterns can match nested nodes, automatically resolved by the matcher and available in the rule using in a type-safe way (without casts re-asserting the types of nodes on the path)\r\n - The match criteria are further expressed in data structures vs method calls, which shifts the flow control from the rule to the optimizer engine (matcher being a customizable part of it)\r\n\r\nThese are well illustrated by the sum of changes in `RemoveEmtpyDeleteRule`.\r\n\r\nHere is a design doc that this PR follows: https://docs.google.com/document/d/17N7CAIwdlbW_kD641ceCJWqeeNJrdPJc1ZrAiz49iuQ/edit#heading=h.ggqtvkmn9uef","created_at":"2017-07-21T08:29:34Z","updated_at":"2017-07-24T22:04:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e85544e3a5a414c80357f733c9d620976f43a43","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/prestodb/presto/pulls/8568/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto/pulls/8568/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/8568/comments","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/654f5896d1b664a364ca4f830647b538f0f53069","head":{"label":"Teradata:feature/new_matcher","ref":"feature/new_matcher","sha":"654f5896d1b664a364ca4f830647b538f0f53069","user":{"login":"Teradata","id":1615979,"avatar_url":"https://avatars1.githubusercontent.com/u/1615979?v=4","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://avatars1.githubusercontent.com/u/1615979?v=4","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":"2017-06-27T21:21:21Z","pushed_at":"2017-07-24T21:13:30Z","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":194968,"stargazers_count":74,"watchers_count":74,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19,"mirror_url":null,"open_issues_count":35,"forks":19,"open_issues":35,"watchers":74,"default_branch":"master"}},"base":{"label":"prestodb:master","ref":"master","sha":"55a0f8937d4ae73c53ddc684851bce7db166c89d","user":{"login":"prestodb","id":6882181,"avatar_url":"https://avatars0.githubusercontent.com/u/6882181?v=4","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"repo":{"id":5349565,"name":"presto","full_name":"prestodb/presto","owner":{"login":"prestodb","id":6882181,"avatar_url":"https://avatars0.githubusercontent.com/u/6882181?v=4","gravatar_id":"","url":"https://api.github.com/users/prestodb","html_url":"https://github.com/prestodb","followers_url":"https://api.github.com/users/prestodb/followers","following_url":"https://api.github.com/users/prestodb/following{/other_user}","gists_url":"https://api.github.com/users/prestodb/gists{/gist_id}","starred_url":"https://api.github.com/users/prestodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestodb/subscriptions","organizations_url":"https://api.github.com/users/prestodb/orgs","repos_url":"https://api.github.com/users/prestodb/repos","events_url":"https://api.github.com/users/prestodb/events{/privacy}","received_events_url":"https://api.github.com/users/prestodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prestodb/presto","description":"Distributed SQL query engine for big data","fork":false,"url":"https://api.github.com/repos/prestodb/presto","forks_url":"https://api.github.com/repos/prestodb/presto/forks","keys_url":"https://api.github.com/repos/prestodb/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prestodb/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prestodb/presto/teams","hooks_url":"https://api.github.com/repos/prestodb/presto/hooks","issue_events_url":"https://api.github.com/repos/prestodb/presto/issues/events{/number}","events_url":"https://api.github.com/repos/prestodb/presto/events","assignees_url":"https://api.github.com/repos/prestodb/presto/assignees{/user}","branches_url":"https://api.github.com/repos/prestodb/presto/branches{/branch}","tags_url":"https://api.github.com/repos/prestodb/presto/tags","blobs_url":"https://api.github.com/repos/prestodb/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prestodb/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prestodb/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/prestodb/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/prestodb/presto/languages","stargazers_url":"https://api.github.com/repos/prestodb/presto/stargazers","contributors_url":"https://api.github.com/repos/prestodb/presto/contributors","subscribers_url":"https://api.github.com/repos/prestodb/presto/subscribers","subscription_url":"https://api.github.com/repos/prestodb/presto/subscription","commits_url":"https://api.github.com/repos/prestodb/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/prestodb/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/prestodb/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/prestodb/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/prestodb/presto/contents/{+path}","compare_url":"https://api.github.com/repos/prestodb/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prestodb/presto/merges","archive_url":"https://api.github.com/repos/prestodb/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prestodb/presto/downloads","issues_url":"https://api.github.com/repos/prestodb/presto/issues{/number}","pulls_url":"https://api.github.com/repos/prestodb/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/prestodb/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/prestodb/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prestodb/presto/labels{/name}","releases_url":"https://api.github.com/repos/prestodb/presto/releases{/id}","deployments_url":"https://api.github.com/repos/prestodb/presto/deployments","created_at":"2012-08-09T01:03:37Z","updated_at":"2017-07-24T14:37:20Z","pushed_at":"2017-07-24T20:54:21Z","git_url":"git://github.com/prestodb/presto.git","ssh_url":"git@github.com:prestodb/presto.git","clone_url":"https://github.com/prestodb/presto.git","svn_url":"https://github.com/prestodb/presto","homepage":"https://prestodb.io","size":76915,"stargazers_count":6286,"watchers_count":6286,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2037,"mirror_url":null,"open_issues_count":1014,"forks":2037,"open_issues":1014,"watchers":6286,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/8568"},"html":{"href":"https://github.com/prestodb/presto/pull/8568"},"issue":{"href":"https://api.github.com/repos/prestodb/presto/issues/8568"},"comments":{"href":"https://api.github.com/repos/prestodb/presto/issues/8568/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto/pulls/8568/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto/pulls/8568/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto/statuses/654f5896d1b664a364ca4f830647b538f0f53069"}}}}
{"actor":{"display_login":"ArturGajowy"}}