{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/presto/issues/3549","labels_url":"https://api.github.com/repos/facebook/presto/issues/3549/labels{/name}","comments_url":"https://api.github.com/repos/facebook/presto/issues/3549/comments","events_url":"https://api.github.com/repos/facebook/presto/issues/3549/events","html_url":"https://github.com/facebook/presto/issues/3549","id":104969066,"number":3549,"title":"Histogram function with map or array input cancels query","user":{"login":"mattsfuller","id":1254211,"avatar_url":"https://avatars.githubusercontent.com/u/1254211?v=3","gravatar_id":"","url":"https://api.github.com/users/mattsfuller","html_url":"https://github.com/mattsfuller","followers_url":"https://api.github.com/users/mattsfuller/followers","following_url":"https://api.github.com/users/mattsfuller/following{/other_user}","gists_url":"https://api.github.com/users/mattsfuller/gists{/gist_id}","starred_url":"https://api.github.com/users/mattsfuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattsfuller/subscriptions","organizations_url":"https://api.github.com/users/mattsfuller/orgs","repos_url":"https://api.github.com/users/mattsfuller/repos","events_url":"https://api.github.com/users/mattsfuller/events{/privacy}","received_events_url":"https://api.github.com/users/mattsfuller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-04T21:02:02Z","updated_at":"2015-09-04T23:56:14Z","closed_at":null,"body":"Getting some odd behavior with the Histogram aggregate function. When I run the query with map or array input, an error message \"Query is gone (server restarted?)\" is returned.\r\n\r\n```\r\npresto:sf1> select histogram(map(array [nationkey%3], array[regionkey])) from nation;\r\nQuery is gone (server restarted?)\r\n\r\npresto:sf1> select histogram(array [nationkey%3, regionkey]) from nation;\r\nQuery is gone (server restarted?)\r\n\r\npresto:sf1> select histogram(arr) from (select array [nationkey%3, regionkey] as arr from nation) T;\r\nQuery is gone (server restarted?)\r\n```\r\n\r\nHere is the stack trace I see. The Query was definitely not canceled by me:\r\n```\r\ncom.facebook.presto.spi.PrestoException: Query was canceled\r\n\tat com.facebook.presto.execution.SqlQueryManager.cancelQuery(SqlQueryManager.java:321)\r\n\tat com.facebook.presto.server.StatementResource$Query.cancel(StatementResource.java:266)\r\n\tat com.facebook.presto.server.StatementResource.cancelQuery(StatementResource.java:214)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:497)\r\n\tat org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)\r\n\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)\r\n\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)\r\n\tat org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)\r\n\tat org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)\r\n\tat org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)\r\n\tat org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)\r\n\tat org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)\r\n\tat org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271)\r\n\tat org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)\r\n\tat org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)\r\n\tat org.glassfish.jersey.internal.Errors.process(Errors.java:315)\r\n\tat org.glassfish.jersey.internal.Errors.process(Errors.java:297)\r\n\tat org.glassfish.jersey.internal.Errors.process(Errors.java:267)\r\n\tat org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)\r\n\tat org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)\r\n\tat org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1030)\r\n\tat org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)\r\n\tat org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)\r\n\tat org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)\r\n\tat org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)\r\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)\r\n\tat org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:300)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\r\n\tat io.airlift.http.server.TraceTokenFilter.doFilter(TraceTokenFilter.java:63)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\r\n\tat io.airlift.http.server.TimingFilter.doFilter(TimingFilter.java:52)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\r\n\tat org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159)\r\n\tat org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:499)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)\r\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n```\r\n\r\nHere is an explain plan of one of the queries:\r\n```\r\npresto:sf1> explain select histogram(array [nationkey%3, regionkey]) from nation;\r\n                                                         Query Plan                                                         \r\n----------------------------------------------------------------------------------------------------------------------------\r\n - Output[_col0] => [histogram:map<array<bigint>,bigint>]                                                                   \r\n         _col0 := histogram                                                                                                 \r\n     - Aggregate(FINAL) => [histogram:map<array<bigint>,bigint>]                                                            \r\n             histogram := \"histogram\"(\"histogram_3\")                                                                        \r\n         - Exchange[GATHER] => histogram_3:map<array<bigint>,bigint>                                                        \r\n             - Aggregate(PARTIAL) => [histogram_3:map<array<bigint>,bigint>]                                                \r\n                     histogram_3 := \"histogram\"(\"expr\")                                                                     \r\n                 - Project => [expr:array<bigint>]                                                                          \r\n                         expr := \"array_constructor\"((\"nationkey\" % 3), \"regionkey\")                                        \r\n                     - TableScan[tpch:tpch:nation:sf1.0, originalConstraint = true] => [nationkey:bigint, regionkey:bigint] \r\n                             nationkey := tpch:nationkey                                                                    \r\n                             regionkey := tpch:regionkey                                                                    \r\n                                                                                                                            \r\n(1 row)\r\n\r\nQuery 20150902_051238_00061_jcraq, FINISHED, 1 node\r\nSplits: 1 total, 1 done (100.00%)\r\n0:00 [0 rows, 0B] [0 rows/s, 0B/s]\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/presto/issues/comments/137880887","html_url":"https://github.com/facebook/presto/issues/3549#issuecomment-137880887","issue_url":"https://api.github.com/repos/facebook/presto/issues/3549","id":137880887,"user":{"login":"dain","id":58298,"avatar_url":"https://avatars.githubusercontent.com/u/58298?v=3","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},"created_at":"2015-09-04T23:56:14Z","updated_at":"2015-09-04T23:56:14Z","body":"The `StatementClient` will send a `DELETE` HTTP request when `close` is called.  Maybe there is some error on the client side that is triggering the `close` call.  I would debug the cli."}}