{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto/pulls/comments/62698187","id":62698187,"diff_hunk":"@@ -0,0 +1,77 @@\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.connector.system;\n+\n+import com.facebook.presto.annotation.UsedByGeneratedCode;\n+import com.facebook.presto.execution.MaterializedQueryTableRefresher;\n+import com.facebook.presto.spi.ConnectorSession;\n+import com.facebook.presto.spi.PrestoException;\n+import com.facebook.presto.spi.StandardErrorCode;\n+import com.facebook.presto.spi.procedure.Procedure;\n+import com.fasterxml.jackson.core.type.TypeReference;\n+import com.fasterxml.jackson.databind.ObjectMapper;\n+import com.google.common.collect.ImmutableList;\n+\n+import javax.inject.Inject;\n+\n+import java.io.IOException;\n+import java.util.Collections;\n+import java.util.Map;\n+\n+import static com.facebook.presto.spi.type.VarcharType.VARCHAR;\n+import static com.facebook.presto.util.Reflection.methodHandle;\n+import static java.util.Objects.requireNonNull;\n+\n+public class RefreshMaterializedQueryTableProcedure\n+{\n+    private final MaterializedQueryTableRefresher tableRefresher;\n+\n+    @Inject\n+    public RefreshMaterializedQueryTableProcedure(MaterializedQueryTableRefresher tableRefresher)\n+    {\n+        this.tableRefresher = requireNonNull(tableRefresher, \"tableRefresher is null\");\n+    }\n+\n+    @UsedByGeneratedCode\n+    public void refresh(String materializedQueryTable, String predicateForBaseTables, String predicateForMaterializedQueryTable, ConnectorSession session) throws Exception\n+    {\n+        tableRefresher.refreshMaterializedQueryTable(materializedQueryTable, parsePredicates(predicateForBaseTables), predicateForMaterializedQueryTable, session);\n+    }\n+\n+    private static Map<String, String> parsePredicates(String predicate)\n+    {\n+        if (predicate == null || predicate.trim().isEmpty()) {\n+            return Collections.EMPTY_MAP;\n+        }\n+\n+        ObjectMapper mapper = new ObjectMapper();","path":"presto-main/src/main/java/com/facebook/presto/connector/system/RefreshMaterializedQueryTableProcedure.java","position":58,"original_position":58,"commit_id":"5e4a3b3511852f3d34ed9a531723411906b2646f","original_commit_id":"b1ab30d8b4b4ab5f13115f6d25c242468608e7e3","user":{"login":"electrum","id":9230,"avatar_url":"https://avatars.githubusercontent.com/u/9230?v=3","gravatar_id":"","url":"https://api.github.com/users/electrum","html_url":"https://github.com/electrum","followers_url":"https://api.github.com/users/electrum/followers","following_url":"https://api.github.com/users/electrum/following{/other_user}","gists_url":"https://api.github.com/users/electrum/gists{/gist_id}","starred_url":"https://api.github.com/users/electrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electrum/subscriptions","organizations_url":"https://api.github.com/users/electrum/orgs","repos_url":"https://api.github.com/users/electrum/repos","events_url":"https://api.github.com/users/electrum/events{/privacy}","received_events_url":"https://api.github.com/users/electrum/received_events","type":"User","site_admin":false},"body":"This class should inject a `JsonCodec`","created_at":"2016-05-10T15:51:48Z","updated_at":"2016-05-10T15:51:48Z","html_url":"https://github.com/prestodb/presto/pull/5237#discussion_r62698187","pull_request_url":"https://api.github.com/repos/prestodb/presto/pulls/5237","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments/62698187"},"html":{"href":"https://github.com/prestodb/presto/pull/5237#discussion_r62698187"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto/pulls/5237"}}},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/5237","id":69445590,"html_url":"https://github.com/prestodb/presto/pull/5237","diff_url":"https://github.com/prestodb/presto/pull/5237.diff","patch_url":"https://github.com/prestodb/presto/pull/5237.patch","issue_url":"https://api.github.com/repos/prestodb/presto/issues/5237","number":5237,"state":"open","locked":false,"title":"Materialized query table","user":{"login":"joy-yao","id":10444908,"avatar_url":"https://avatars.githubusercontent.com/u/10444908?v=3","gravatar_id":"","url":"https://api.github.com/users/joy-yao","html_url":"https://github.com/joy-yao","followers_url":"https://api.github.com/users/joy-yao/followers","following_url":"https://api.github.com/users/joy-yao/following{/other_user}","gists_url":"https://api.github.com/users/joy-yao/gists{/gist_id}","starred_url":"https://api.github.com/users/joy-yao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joy-yao/subscriptions","organizations_url":"https://api.github.com/users/joy-yao/orgs","repos_url":"https://api.github.com/users/joy-yao/repos","events_url":"https://api.github.com/users/joy-yao/events{/privacy}","received_events_url":"https://api.github.com/users/joy-yao/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-10T03:54:01Z","updated_at":"2016-05-10T15:51:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25b4b9fca931cc4e221874f1020257b68d592c4a","assignee":{"login":"erichwang","id":737851,"avatar_url":"https://avatars.githubusercontent.com/u/737851?v=3","gravatar_id":"","url":"https://api.github.com/users/erichwang","html_url":"https://github.com/erichwang","followers_url":"https://api.github.com/users/erichwang/followers","following_url":"https://api.github.com/users/erichwang/following{/other_user}","gists_url":"https://api.github.com/users/erichwang/gists{/gist_id}","starred_url":"https://api.github.com/users/erichwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erichwang/subscriptions","organizations_url":"https://api.github.com/users/erichwang/orgs","repos_url":"https://api.github.com/users/erichwang/repos","events_url":"https://api.github.com/users/erichwang/events{/privacy}","received_events_url":"https://api.github.com/users/erichwang/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/prestodb/presto/pulls/5237/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto/pulls/5237/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/5237/comments","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/5e4a3b3511852f3d34ed9a531723411906b2646f","head":{"label":"joy-yao:mview","ref":"mview","sha":"5e4a3b3511852f3d34ed9a531723411906b2646f","user":{"login":"joy-yao","id":10444908,"avatar_url":"https://avatars.githubusercontent.com/u/10444908?v=3","gravatar_id":"","url":"https://api.github.com/users/joy-yao","html_url":"https://github.com/joy-yao","followers_url":"https://api.github.com/users/joy-yao/followers","following_url":"https://api.github.com/users/joy-yao/following{/other_user}","gists_url":"https://api.github.com/users/joy-yao/gists{/gist_id}","starred_url":"https://api.github.com/users/joy-yao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joy-yao/subscriptions","organizations_url":"https://api.github.com/users/joy-yao/orgs","repos_url":"https://api.github.com/users/joy-yao/repos","events_url":"https://api.github.com/users/joy-yao/events{/privacy}","received_events_url":"https://api.github.com/users/joy-yao/received_events","type":"User","site_admin":false},"repo":{"id":29157409,"name":"presto","full_name":"joy-yao/presto","owner":{"login":"joy-yao","id":10444908,"avatar_url":"https://avatars.githubusercontent.com/u/10444908?v=3","gravatar_id":"","url":"https://api.github.com/users/joy-yao","html_url":"https://github.com/joy-yao","followers_url":"https://api.github.com/users/joy-yao/followers","following_url":"https://api.github.com/users/joy-yao/following{/other_user}","gists_url":"https://api.github.com/users/joy-yao/gists{/gist_id}","starred_url":"https://api.github.com/users/joy-yao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joy-yao/subscriptions","organizations_url":"https://api.github.com/users/joy-yao/orgs","repos_url":"https://api.github.com/users/joy-yao/repos","events_url":"https://api.github.com/users/joy-yao/events{/privacy}","received_events_url":"https://api.github.com/users/joy-yao/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joy-yao/presto","description":"Distributed SQL query engine for running interactive analytic queries against big data sources.","fork":true,"url":"https://api.github.com/repos/joy-yao/presto","forks_url":"https://api.github.com/repos/joy-yao/presto/forks","keys_url":"https://api.github.com/repos/joy-yao/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joy-yao/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joy-yao/presto/teams","hooks_url":"https://api.github.com/repos/joy-yao/presto/hooks","issue_events_url":"https://api.github.com/repos/joy-yao/presto/issues/events{/number}","events_url":"https://api.github.com/repos/joy-yao/presto/events","assignees_url":"https://api.github.com/repos/joy-yao/presto/assignees{/user}","branches_url":"https://api.github.com/repos/joy-yao/presto/branches{/branch}","tags_url":"https://api.github.com/repos/joy-yao/presto/tags","blobs_url":"https://api.github.com/repos/joy-yao/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joy-yao/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joy-yao/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/joy-yao/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joy-yao/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/joy-yao/presto/languages","stargazers_url":"https://api.github.com/repos/joy-yao/presto/stargazers","contributors_url":"https://api.github.com/repos/joy-yao/presto/contributors","subscribers_url":"https://api.github.com/repos/joy-yao/presto/subscribers","subscription_url":"https://api.github.com/repos/joy-yao/presto/subscription","commits_url":"https://api.github.com/repos/joy-yao/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/joy-yao/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/joy-yao/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/joy-yao/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/joy-yao/presto/contents/{+path}","compare_url":"https://api.github.com/repos/joy-yao/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joy-yao/presto/merges","archive_url":"https://api.github.com/repos/joy-yao/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joy-yao/presto/downloads","issues_url":"https://api.github.com/repos/joy-yao/presto/issues{/number}","pulls_url":"https://api.github.com/repos/joy-yao/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/joy-yao/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/joy-yao/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joy-yao/presto/labels{/name}","releases_url":"https://api.github.com/repos/joy-yao/presto/releases{/id}","deployments_url":"https://api.github.com/repos/joy-yao/presto/deployments","created_at":"2015-01-12T21:17:47Z","updated_at":"2016-01-11T20:44:00Z","pushed_at":"2016-05-10T03:58:39Z","git_url":"git://github.com/joy-yao/presto.git","ssh_url":"git@github.com:joy-yao/presto.git","clone_url":"https://github.com/joy-yao/presto.git","svn_url":"https://github.com/joy-yao/presto","homepage":"http://prestodb.io/","size":54836,"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":"prestodb:master","ref":"master","sha":"b4cef872f8429ea78bc13f1ac2b3fa5eb3723d3a","user":{"login":"prestodb","id":6882181,"avatar_url":"https://avatars.githubusercontent.com/u/6882181?v=3","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://avatars.githubusercontent.com/u/6882181?v=3","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":"2016-05-10T13:00:14Z","pushed_at":"2016-05-10T15:39:31Z","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":150856,"stargazers_count":4734,"watchers_count":4734,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1380,"mirror_url":null,"open_issues_count":516,"forks":1380,"open_issues":516,"watchers":4734,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/5237"},"html":{"href":"https://github.com/prestodb/presto/pull/5237"},"issue":{"href":"https://api.github.com/repos/prestodb/presto/issues/5237"},"comments":{"href":"https://api.github.com/repos/prestodb/presto/issues/5237/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto/pulls/5237/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto/pulls/5237/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto/statuses/5e4a3b3511852f3d34ed9a531723411906b2646f"}}}}