{"action":"created","issue":{"url":"https://api.github.com/repos/prestodb/presto/issues/11169","repository_url":"https://api.github.com/repos/prestodb/presto","labels_url":"https://api.github.com/repos/prestodb/presto/issues/11169/labels{/name}","comments_url":"https://api.github.com/repos/prestodb/presto/issues/11169/comments","events_url":"https://api.github.com/repos/prestodb/presto/issues/11169/events","html_url":"https://github.com/prestodb/presto/issues/11169","id":346623830,"node_id":"MDU6SXNzdWUzNDY2MjM4MzA=","number":11169,"title":"TableScanNode should add its output symbols as aliases?","user":{"login":"atris","id":1724131,"node_id":"MDQ6VXNlcjE3MjQxMzE=","avatar_url":"https://avatars0.githubusercontent.com/u/1724131?v=4","gravatar_id":"","url":"https://api.github.com/users/atris","html_url":"https://github.com/atris","followers_url":"https://api.github.com/users/atris/followers","following_url":"https://api.github.com/users/atris/following{/other_user}","gists_url":"https://api.github.com/users/atris/gists{/gist_id}","starred_url":"https://api.github.com/users/atris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atris/subscriptions","organizations_url":"https://api.github.com/users/atris/orgs","repos_url":"https://api.github.com/users/atris/repos","events_url":"https://api.github.com/users/atris/events{/privacy}","received_events_url":"https://api.github.com/users/atris/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-01T14:25:16Z","updated_at":"2018-08-07T13:00:22Z","closed_at":"2018-08-07T13:00:22Z","author_association":"NONE","body":"I am writing a test where the initial plan looks like:\r\n``p.lateral(\r\n                               ImmutableList.of(p.symbol(\"nationkey\")),\r\n                               p.tableScan(ImmutableList.of(p.symbol(\"nationkey\")),\r\n                                       ImmutableMap.of(p.symbol(\"nationkey\"), new TpchColumnHandle(\"tpch:nationkey\",\r\n                                               BIGINT))),\r\n                               p.project(\r\n                                       Assignments.of(p.symbol(\"nationkey + 1\"), expression(\"nationkey\")),\r\n                                       p.values(\r\n                                               ImmutableList.of(),\r\n                                               ImmutableList.of(\r\n                                                       ImmutableList.of())))))``\r\n\r\nThe transformed plan will be:\r\n``ProjectNode -> (nationkey + 1 -> nationkey), (nationkey -> nationkey)\r\n TableScanNode (nationkey)``\r\n\r\nI am using the following plan as the expected output match:\r\n``project(\r\n                       ImmutableMap.of(\r\n                               \"nationkey\", PlanMatchPattern.expression(\"nationkey\"),\r\n                               \"nationkey + 1\", PlanMatchPattern.expression(\"nationkey\")),\r\n                       any()));``\r\n\r\nHowever, this is erroring out with the error: missing expression for alias nationkey\r\nI looked a bit deeper and figured that during the match, we will try to upmatch the ``ProjectNode`` with the aliases from its source nodes.\r\n\r\nIn this case, the source node is a ``TableScanNode``, which is a leaf\r\nSo the aliases for the search should come from TableScanNode\r\n\r\nHowever, ``TableScanNode`` delegates to ``matchLeaf``, which will create an empty set of Symbols\r\nMy query is, shouldnt TableScanNode add its output symbols to the aliases list as well?\r\n\r\nSince ``TableScanNode`` returns an empty list of Symbols, the matching for ``ProjectNode`` fails with the error."},"comment":{"url":"https://api.github.com/repos/prestodb/presto/issues/comments/411047377","html_url":"https://github.com/prestodb/presto/issues/11169#issuecomment-411047377","issue_url":"https://api.github.com/repos/prestodb/presto/issues/11169","id":411047377,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTA0NzM3Nw==","user":{"login":"atris","id":1724131,"node_id":"MDQ6VXNlcjE3MjQxMzE=","avatar_url":"https://avatars0.githubusercontent.com/u/1724131?v=4","gravatar_id":"","url":"https://api.github.com/users/atris","html_url":"https://github.com/atris","followers_url":"https://api.github.com/users/atris/followers","following_url":"https://api.github.com/users/atris/following{/other_user}","gists_url":"https://api.github.com/users/atris/gists{/gist_id}","starred_url":"https://api.github.com/users/atris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atris/subscriptions","organizations_url":"https://api.github.com/users/atris/orgs","repos_url":"https://api.github.com/users/atris/repos","events_url":"https://api.github.com/users/atris/events{/privacy}","received_events_url":"https://api.github.com/users/atris/received_events","type":"User","site_admin":false},"created_at":"2018-08-07T13:00:22Z","updated_at":"2018-08-07T13:00:22Z","author_association":"NONE","body":"Got the answer, since we do not have a way of eliminating duplicate symbols from multiple TableScanNodes, hence why."}}
{"actor":{"display_login":"atris"}}