{"action":"opened","issue":{"url":"https://api.github.com/repos/prestodb/presto/issues/10058","repository_url":"https://api.github.com/repos/prestodb/presto","labels_url":"https://api.github.com/repos/prestodb/presto/issues/10058/labels{/name}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/10058/comments","events_url":"https://api.github.com/repos/prestodb/presto/issues/10058/events","html_url":"https://github.com/prestodb/presto/issues/10058","id":301345586,"number":10058,"title":"Presto doesn't remove columns from plans which can be concluded to be literals","user":{"login":"sopel39","id":5989165,"avatar_url":"https://avatars1.githubusercontent.com/u/5989165?v=4","gravatar_id":"","url":"https://api.github.com/users/sopel39","html_url":"https://github.com/sopel39","followers_url":"https://api.github.com/users/sopel39/followers","following_url":"https://api.github.com/users/sopel39/following{/other_user}","gists_url":"https://api.github.com/users/sopel39/gists{/gist_id}","starred_url":"https://api.github.com/users/sopel39/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sopel39/subscriptions","organizations_url":"https://api.github.com/users/sopel39/orgs","repos_url":"https://api.github.com/users/sopel39/repos","events_url":"https://api.github.com/users/sopel39/events{/privacy}","received_events_url":"https://api.github.com/users/sopel39/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-01T10:08:06Z","updated_at":"2018-03-01T10:08:06Z","closed_at":null,"author_association":"MEMBER","body":"```\r\npresto> explain select y from (select x from (values 3) t(x) where x = 3), (select y from (values 3) t(y)) where x=y;\r\n                                                               Query Plan\r\n----------------------------------------------------------------------------------------------------------------------------------------\r\n - Output[y] => [field_4:integer]\r\n         Cost: {rows: 1 (10B), cpu: 200.00, memory: 80.00, network: 0.00}\r\n         y := field_4\r\n     - CrossJoin => [field_4:integer]\r\n             Distribution: REPLICATED\r\n             Cost: {rows: 1 (10B), cpu: 200.00, memory: 80.00, network: 0.00}\r\n         - FilterProject[filterPredicate = (\"field\" = 3)] => []\r\n                 Cost: {rows: 1 (10B), cpu: 20.00, memory: 0.00, network: 0.00}/{rows: 1 (0B), cpu: 20.00, memory: 0.00, network: 0.00}\r\n             - LocalExchange[ROUND_ROBIN] () => field:integer\r\n                     Cost: {rows: 1 (10B), cpu: 10.00, memory: 0.00, network: 0.00}\r\n                 - Values => [field:integer]\r\n                         Cost: {rows: 1 (10B), cpu: 0.00, memory: 0.00, network: 0.00}\r\n                         (3)\r\n         - LocalExchange[SINGLE] () => field_4:integer\r\n                 Cost: {rows: 1 (10B), cpu: 20.00, memory: 0.00, network: 0.00}\r\n             - Filter[filterPredicate = (3 = \"field_4\")] => [field_4:integer]\r\n                     Cost: {rows: 1 (10B), cpu: 20.00, memory: 0.00, network: 0.00}\r\n                 - LocalExchange[ROUND_ROBIN] () => field_4:integer\r\n                         Cost: {rows: 1 (10B), cpu: 10.00, memory: 0.00, network: 0.00}\r\n                     - Values => [field_4:integer]\r\n                             Cost: {rows: 1 (10B), cpu: 0.00, memory: 0.00, network: 0.00}\r\n                             (3)\r\n```\r\nIn this case we can conclude that `field_4=3` therefore we could just remove the symbol completely above `- Filter[filterPredicate = (3 = \"field_4\")] => [field_4:integer]`\r\n\r\nProbably we need a rule that based on effective predicate (watch out for nulls!!!) would try to simplify expressions by rewriting them without usage of symbols (one by one)  \r\n\r\nFYI: @martint @findepi "}}
{"actor":{"display_login":"sopel39"}}