{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/presto/issues/3297","labels_url":"https://api.github.com/repos/facebook/presto/issues/3297/labels{/name}","comments_url":"https://api.github.com/repos/facebook/presto/issues/3297/comments","events_url":"https://api.github.com/repos/facebook/presto/issues/3297/events","html_url":"https://github.com/facebook/presto/issues/3297","id":95616580,"number":3297,"title":"Explain on queries with timestamp literal fails","user":{"login":"snarayananqubole","id":5491710,"avatar_url":"https://avatars.githubusercontent.com/u/5491710?v=3","gravatar_id":"","url":"https://api.github.com/users/snarayananqubole","html_url":"https://github.com/snarayananqubole","followers_url":"https://api.github.com/users/snarayananqubole/followers","following_url":"https://api.github.com/users/snarayananqubole/following{/other_user}","gists_url":"https://api.github.com/users/snarayananqubole/gists{/gist_id}","starred_url":"https://api.github.com/users/snarayananqubole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snarayananqubole/subscriptions","organizations_url":"https://api.github.com/users/snarayananqubole/orgs","repos_url":"https://api.github.com/users/snarayananqubole/repos","events_url":"https://api.github.com/users/snarayananqubole/events{/privacy}","received_events_url":"https://api.github.com/users/snarayananqubole/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-17T08:54:14Z","updated_at":"2015-07-17T09:09:02Z","closed_at":null,"body":"This is on v 0.105. Connected with redshift via Presto using the postgresql connector. Ran this explain query and it failed.\r\n\r\n```\r\npresto:default> explain select * from redshift.public.foo where ts < date '2015-01-01';\r\nQuery 20150717_082917_00013_kjwwm failed: cannot convert MethodHandle(ConnectorSession,long)Slice to (Object)Object\r\njava.lang.invoke.WrongMethodTypeException: cannot convert MethodHandle(ConnectorSession,long)Slice to (Object)Object\r\n        at java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:776)\r\n        at java.lang.invoke.MethodHandle.asType(MethodHandle.java:770)\r\n        at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:633)\r\n        at com.facebook.presto.sql.planner.PlanPrinter.formatDomain(PlanPrinter.java:617)\r\n        at com.facebook.presto.sql.planner.PlanPrinter.printConstraint(PlanPrinter.java:578)\r\n        at com.facebook.presto.sql.planner.PlanPrinter.access$200(PlanPrinter.java:88)\r\n        at com.facebook.presto.sql.planner.PlanPrinter$Visitor.visitTableScan(PlanPrinter.java:407)\r\n        at com.facebook.presto.sql.planner.PlanPrinter$Visitor.visitTableScan(PlanPrinter.java:185)\r\n        at com.facebook.presto.sql.planner.plan.TableScanNode.accept(TableScanNode.java:135)\r\n        <snip>\r\n```\r\nPlanPrinter::formatDomain tries to convert domain to a printable string. The function to do this for timestamp is: \r\n```\r\n    @ScalarOperator(CAST)\r\n    @SqlType(StandardTypes.VARCHAR)\r\n    public static Slice castToSlice(ConnectorSession session, @SqlType(StandardTypes.TIMESTAMP) long value)\r\n```\r\n\r\nThis guy needs ConnectorSession instance which isn't available in PlanPrinter.\r\n\r\nPlease close it if it is already fixed in trunk."},"comment":{"url":"https://api.github.com/repos/facebook/presto/issues/comments/122225177","html_url":"https://github.com/facebook/presto/issues/3297#issuecomment-122225177","issue_url":"https://api.github.com/repos/facebook/presto/issues/3297","id":122225177,"user":{"login":"yuananf","id":4101738,"avatar_url":"https://avatars.githubusercontent.com/u/4101738?v=3","gravatar_id":"","url":"https://api.github.com/users/yuananf","html_url":"https://github.com/yuananf","followers_url":"https://api.github.com/users/yuananf/followers","following_url":"https://api.github.com/users/yuananf/following{/other_user}","gists_url":"https://api.github.com/users/yuananf/gists{/gist_id}","starred_url":"https://api.github.com/users/yuananf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuananf/subscriptions","organizations_url":"https://api.github.com/users/yuananf/orgs","repos_url":"https://api.github.com/users/yuananf/repos","events_url":"https://api.github.com/users/yuananf/events{/privacy}","received_events_url":"https://api.github.com/users/yuananf/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T09:09:02Z","updated_at":"2015-07-17T09:09:02Z","body":"This is the same as #3201 "}}