{"action":"created","comment":{"url":"https://api.github.com/repos/prestodb/presto/pulls/comments/176955884","pull_request_review_id":106745219,"id":176955884,"diff_hunk":"@@ -192,8 +205,22 @@ public void queryCompletedEvent(QueryInfo queryInfo)\n             }\n \n             Optional<String> plan = Optional.empty();\n-            if (queryInfo.getPlan().isPresent()) {\n-                plan = Optional.of(objectMapper.writeValueAsString(queryInfo.getPlan().get()));\n+            try {\n+                if (queryInfo.getOutputStage().isPresent()) {\n+                    Session session = queryInfo.getSession().toSession(sessionPropertyManager);\n+                    plan = Optional.of(textDistributedPlan(\n+                            queryInfo.getOutputStage().get(),\n+                            functionRegistry,\n+                            new ComposableStatsCalculator(ImmutableList.of()),\n+                            new CostCalculatorUsingExchanges(() -> 1),\n+                            session,\n+                            false));\n+                }\n+                if (!plan.isPresent() && queryInfo.getPlan().isPresent()) {\n+                    plan = Optional.of(objectMapper.writeValueAsString(queryInfo.getPlan().get()));\n+                }\n+            }\n+            catch (Exception ignored) {","path":"presto-main/src/main/java/com/facebook/presto/event/query/QueryMonitor.java","position":null,"original_position":79,"commit_id":"c3880eff9a396e0b0ef20d6d7c4a7f4c166bab1a","original_commit_id":"5238267ddb7aefc76610d147b9f6fbe0c0d49e9a","user":{"login":"findepi","id":144328,"avatar_url":"https://avatars0.githubusercontent.com/u/144328?v=4","gravatar_id":"","url":"https://api.github.com/users/findepi","html_url":"https://github.com/findepi","followers_url":"https://api.github.com/users/findepi/followers","following_url":"https://api.github.com/users/findepi/following{/other_user}","gists_url":"https://api.github.com/users/findepi/gists{/gist_id}","starred_url":"https://api.github.com/users/findepi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/findepi/subscriptions","organizations_url":"https://api.github.com/users/findepi/orgs","repos_url":"https://api.github.com/users/findepi/repos","events_url":"https://api.github.com/users/findepi/events{/privacy}","received_events_url":"https://api.github.com/users/findepi/received_events","type":"User","site_admin":false},"body":"understood. Then at least log the exception, as it's totally unexpected","created_at":"2018-03-25T21:58:56Z","updated_at":"2018-03-25T21:58:56Z","html_url":"https://github.com/prestodb/presto/pull/10241#discussion_r176955884","pull_request_url":"https://api.github.com/repos/prestodb/presto/pulls/10241","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments/176955884"},"html":{"href":"https://github.com/prestodb/presto/pull/10241#discussion_r176955884"},"pull_request":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10241"}},"in_reply_to_id":176917059},"pull_request":{"url":"https://api.github.com/repos/prestodb/presto/pulls/10241","id":176946314,"html_url":"https://github.com/prestodb/presto/pull/10241","diff_url":"https://github.com/prestodb/presto/pull/10241.diff","patch_url":"https://github.com/prestodb/presto/pull/10241.patch","issue_url":"https://api.github.com/repos/prestodb/presto/issues/10241","number":10241,"state":"open","locked":false,"title":"Use explain plan in QueryCompletedEvent if possible","user":{"login":"dain","id":58298,"avatar_url":"https://avatars0.githubusercontent.com/u/58298?v=4","gravatar_id":"","url":"https://api.github.com/users/dain","html_url":"https://github.com/dain","followers_url":"https://api.github.com/users/dain/followers","following_url":"https://api.github.com/users/dain/following{/other_user}","gists_url":"https://api.github.com/users/dain/gists{/gist_id}","starred_url":"https://api.github.com/users/dain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dain/subscriptions","organizations_url":"https://api.github.com/users/dain/orgs","repos_url":"https://api.github.com/users/dain/repos","events_url":"https://api.github.com/users/dain/events{/privacy}","received_events_url":"https://api.github.com/users/dain/received_events","type":"User","site_admin":false},"body":null,"created_at":"2018-03-23T00:41:37Z","updated_at":"2018-03-25T21:58:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"405f9876fa7b338328ec2d3eb86eb426ec78dbe6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":196992743,"url":"https://api.github.com/repos/prestodb/presto/labels/CLA%20Signed","name":"CLA Signed","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/prestodb/presto/pulls/10241/commits","review_comments_url":"https://api.github.com/repos/prestodb/presto/pulls/10241/comments","review_comment_url":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/10241/comments","statuses_url":"https://api.github.com/repos/prestodb/presto/statuses/c3880eff9a396e0b0ef20d6d7c4a7f4c166bab1a","head":{"label":"dain:explain-analyze-plan-in-completion-event","ref":"explain-analyze-plan-in-completion-event","sha":"c3880eff9a396e0b0ef20d6d7c4a7f4c166bab1a","user":{"login":"dain","id":58298,"avatar_url":"https://avatars0.githubusercontent.com/u/58298?v=4","gravatar_id":"","url":"https://api.github.com/users/dain","html_url":"https://github.com/dain","followers_url":"https://api.github.com/users/dain/followers","following_url":"https://api.github.com/users/dain/following{/other_user}","gists_url":"https://api.github.com/users/dain/gists{/gist_id}","starred_url":"https://api.github.com/users/dain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dain/subscriptions","organizations_url":"https://api.github.com/users/dain/orgs","repos_url":"https://api.github.com/users/dain/repos","events_url":"https://api.github.com/users/dain/events{/privacy}","received_events_url":"https://api.github.com/users/dain/received_events","type":"User","site_admin":false},"repo":{"id":5403482,"name":"presto","full_name":"dain/presto","owner":{"login":"dain","id":58298,"avatar_url":"https://avatars0.githubusercontent.com/u/58298?v=4","gravatar_id":"","url":"https://api.github.com/users/dain","html_url":"https://github.com/dain","followers_url":"https://api.github.com/users/dain/followers","following_url":"https://api.github.com/users/dain/following{/other_user}","gists_url":"https://api.github.com/users/dain/gists{/gist_id}","starred_url":"https://api.github.com/users/dain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dain/subscriptions","organizations_url":"https://api.github.com/users/dain/orgs","repos_url":"https://api.github.com/users/dain/repos","events_url":"https://api.github.com/users/dain/events{/privacy}","received_events_url":"https://api.github.com/users/dain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dain/presto","description":"Distributed SQL query engine for big data","fork":true,"url":"https://api.github.com/repos/dain/presto","forks_url":"https://api.github.com/repos/dain/presto/forks","keys_url":"https://api.github.com/repos/dain/presto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dain/presto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dain/presto/teams","hooks_url":"https://api.github.com/repos/dain/presto/hooks","issue_events_url":"https://api.github.com/repos/dain/presto/issues/events{/number}","events_url":"https://api.github.com/repos/dain/presto/events","assignees_url":"https://api.github.com/repos/dain/presto/assignees{/user}","branches_url":"https://api.github.com/repos/dain/presto/branches{/branch}","tags_url":"https://api.github.com/repos/dain/presto/tags","blobs_url":"https://api.github.com/repos/dain/presto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dain/presto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dain/presto/git/refs{/sha}","trees_url":"https://api.github.com/repos/dain/presto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dain/presto/statuses/{sha}","languages_url":"https://api.github.com/repos/dain/presto/languages","stargazers_url":"https://api.github.com/repos/dain/presto/stargazers","contributors_url":"https://api.github.com/repos/dain/presto/contributors","subscribers_url":"https://api.github.com/repos/dain/presto/subscribers","subscription_url":"https://api.github.com/repos/dain/presto/subscription","commits_url":"https://api.github.com/repos/dain/presto/commits{/sha}","git_commits_url":"https://api.github.com/repos/dain/presto/git/commits{/sha}","comments_url":"https://api.github.com/repos/dain/presto/comments{/number}","issue_comment_url":"https://api.github.com/repos/dain/presto/issues/comments{/number}","contents_url":"https://api.github.com/repos/dain/presto/contents/{+path}","compare_url":"https://api.github.com/repos/dain/presto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dain/presto/merges","archive_url":"https://api.github.com/repos/dain/presto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dain/presto/downloads","issues_url":"https://api.github.com/repos/dain/presto/issues{/number}","pulls_url":"https://api.github.com/repos/dain/presto/pulls{/number}","milestones_url":"https://api.github.com/repos/dain/presto/milestones{/number}","notifications_url":"https://api.github.com/repos/dain/presto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dain/presto/labels{/name}","releases_url":"https://api.github.com/repos/dain/presto/releases{/id}","deployments_url":"https://api.github.com/repos/dain/presto/deployments","created_at":"2012-08-13T19:14:12Z","updated_at":"2018-03-22T20:41:46Z","pushed_at":"2018-03-25T19:06:30Z","git_url":"git://github.com/dain/presto.git","ssh_url":"git@github.com:dain/presto.git","clone_url":"https://github.com/dain/presto.git","svn_url":"https://github.com/dain/presto","homepage":"http://prestodb.io/","size":90291,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"prestodb:master","ref":"master","sha":"a696c3a478eaeff64e57f8148ecd2689456e6b15","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":"2018-03-25T13:49:16Z","pushed_at":"2018-03-25T18:29:00Z","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":88835,"stargazers_count":7261,"watchers_count":7261,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2438,"mirror_url":null,"archived":false,"open_issues_count":1252,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2438,"open_issues":1252,"watchers":7261,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10241"},"html":{"href":"https://github.com/prestodb/presto/pull/10241"},"issue":{"href":"https://api.github.com/repos/prestodb/presto/issues/10241"},"comments":{"href":"https://api.github.com/repos/prestodb/presto/issues/10241/comments"},"review_comments":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10241/comments"},"review_comment":{"href":"https://api.github.com/repos/prestodb/presto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prestodb/presto/pulls/10241/commits"},"statuses":{"href":"https://api.github.com/repos/prestodb/presto/statuses/c3880eff9a396e0b0ef20d6d7c4a7f4c166bab1a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"findepi"}}