ORDER BY ERROR

Dear friends in druid community:

I queried my data from druid.

The query sentence is:

SELECT * FROM tutorial ORDER by sum_added DESC

But I encountered an error.

Anyone who can help me? And I paste the broker log in the following.

Set#3, type: RecordType(TIMESTAMP(3) __time, VARCHAR channel, VARCHAR cityName, VARCHAR comment, BIGINT count, VARCHAR countryIsoCode, VARCHAR countryName, VARCHAR isAnonymous, VARCHAR isMinor, VARCHAR isNew, VARCHAR isRobot, VARCHAR isUnpatrolled, VARCHAR namespace, VARCHAR page, VARCHAR regionIsoCode, VARCHAR regionName, BIGINT sum_added, BIGINT sum_deleted, BIGINT sum_delta, BIGINT sum_metroCode, VARCHAR user)

rel#307042:Subset#3.NONE., best=null, importance=0.81

rel#307007:LogicalTableScan.NONE.(table=[druid, tutorial]), rowcount=100.0, cumulative cost={inf}

rel#307043:LogicalProject.NONE., rowcount=100.0, cumulative cost={inf}

rel#307045:LogicalSort.NONE.16 DESC, rowcount=100.0, cumulative cost={inf}

rel#307057:LogicalSort.NONE.16 DESC, rowcount=100.0, cumulative cost={inf}

rel#307073:LogicalProject.NONE.[16 DESC](input=rel#307061:Subset#3.NONE.[16 DESC],__time=$0,channel=$1,cityName=$2,comment=$3,count=$4,countryIsoCode=$5,countryName=$6,isAnonymous=$7,isMinor=$8,isNew=$9,isRobot=$10,isUnpatrolled=$11,namespace=$12,page=$13,regionIsoCode=$14,regionName=$15,sum_added=$16,sum_deleted=$17,sum_delta=$18,sum_metroCode=$19,user=$20), rowcount=100.0, cumulative cost={inf}

rel#307061:Subset#3.NONE.[16 DESC], best=null, importance=0.9

rel#307045:LogicalSort.NONE.16 DESC, rowcount=100.0, cumulative cost={inf}

rel#307057:LogicalSort.NONE.16 DESC, rowcount=100.0, cumulative cost={inf}

rel#307073:LogicalProject.NONE.[16 DESC](input=rel#307061:Subset#3.NONE.[16 DESC],__time=$0,channel=$1,cityName=$2,comment=$3,count=$4,countryIsoCode=$5,countryName=$6,isAnonymous=$7,isMinor=$8,isNew=$9,isRobot=$10,isUnpatrolled=$11,namespace=$12,page=$13,regionIsoCode=$14,regionName=$15,sum_added=$16,sum_deleted=$17,sum_delta=$18,sum_metroCode=$19,user=$20), rowcount=100.0, cumulative cost={inf}

rel#307062:Subset#3.BINDABLE., best=null, importance=0.7290000000000001

rel#307048:AbstractConverter.BINDABLE.[16 DESC](input=rel#307061:Subset#3.NONE.[16 DESC],convention=BINDABLE,sort=[16 DESC]), rowcount=100.0, cumulative cost={inf}

rel#307049:InterpretableConverter.BINDABLE.[16 DESC](input=rel#307061:Subset#3.NONE.[16 DESC]), rowcount=100.0, cumulative cost={inf}

rel#307053:BindableSort.BINDABLE.16 DESC, rowcount=100.0, cumulative cost={inf}

rel#307056:AbstractConverter.BINDABLE.[16 DESC](input=rel#307062:Subset#3.BINDABLE.,convention=BINDABLE,sort=[16 DESC]), rowcount=100.0, cumulative cost={inf}

rel#307065:InterpretableConverter.BINDABLE., rowcount=100.0, cumulative cost={inf}

rel#307066:BindableProject.BINDABLE., rowcount=100.0, cumulative cost={inf}

rel#307085:BindableProject.BINDABLE.[16 DESC](input=rel#307063:Subset#3.BINDABLE.[16 DESC],__time=$0,channel=$1,cityName=$2,comment=$3,count=$4,countryIsoCode=$5,countryName=$6,isAnonymous=$7,isMinor=$8,isNew=$9,isRobot=$10,isUnpatrolled=$11,namespace=$12,page=$13,regionIsoCode=$14,regionName=$15,sum_added=$16,sum_deleted=$17,sum_delta=$18,sum_metroCode=$19,user=$20), rowcount=100.0, cumulative cost={inf}

rel#307063:Subset#3.BINDABLE.[16 DESC], best=null, importance=1.0

rel#307048:AbstractConverter.BINDABLE.[16 DESC](input=rel#307061:Subset#3.NONE.[16 DESC],convention=BINDABLE,sort=[16 DESC]), rowcount=100.0, cumulative cost={inf}

rel#307049:InterpretableConverter.BINDABLE.[16 DESC](input=rel#307061:Subset#3.NONE.[16 DESC]), rowcount=100.0, cumulative cost={inf}

rel#307053:BindableSort.BINDABLE.16 DESC, rowcount=100.0, cumulative cost={inf}

rel#307056:AbstractConverter.BINDABLE.[16 DESC](input=rel#307062:Subset#3.BINDABLE.,convention=BINDABLE,sort=[16 DESC]), rowcount=100.0, cumulative cost={inf}

rel#307085:BindableProject.BINDABLE.[16 DESC](input=rel#307063:Subset#3.BINDABLE.[16 DESC],__time=$0,channel=$1,cityName=$2,comment=$3,count=$4,countryIsoCode=$5,countryName=$6,isAnonymous=$7,isMinor=$8,isNew=$9,isRobot=$10,isUnpatrolled=$11,namespace=$12,page=$13,regionIsoCode=$14,regionName=$15,sum_added=$16,sum_deleted=$17,sum_delta=$18,sum_metroCode=$19,user=$20), rowcount=100.0, cumulative cost={inf}

at org.apache.calcite.plan.volcano.RelSubset$CheapestPlanReplacer.visit(RelSubset.java:437) ~[calcite-core-1.17.0.jar:1.17.0]

at org.apache.calcite.plan.volcano.RelSubset.buildCheapestPlan(RelSubset.java:296) ~[calcite-core-1.17.0.jar:1.17.0]

at org.apache.calcite.plan.volcano.VolcanoPlanner.findBestExp(VolcanoPlanner.java:662) ~[calcite-core-1.17.0.jar:1.17.0]

at org.apache.calcite.tools.Programs$RuleSetProgram.run(Programs.java:339) ~[calcite-core-1.17.0.jar:1.17.0]

at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:358) ~[calcite-core-1.17.0.jar:1.17.0]

at org.apache.calcite.prepare.PlannerImpl.transform(PlannerImpl.java:337) ~[calcite-core-1.17.0.jar:1.17.0]

at org.apache.druid.sql.calcite.planner.DruidPlanner.planWithBindableConvention(DruidPlanner.java:169) ~[druid-sql-0.15.1-incubating.jar:0.15.1-incubating]

at org.apache.druid.sql.calcite.planner.DruidPlanner.plan(DruidPlanner.java:94) ~[druid-sql-0.15.1-incubating.jar:0.15.1-incubating]

at org.apache.druid.sql.SqlLifecycle.plan(SqlLifecycle.java:143) ~[druid-sql-0.15.1-incubating.jar:0.15.1-incubating]

at org.apache.druid.sql.SqlLifecycle.plan(SqlLifecycle.java:154) ~[druid-sql-0.15.1-incubating.jar:0.15.1-incubating]

at org.apache.druid.sql.SqlLifecycle.planAndAuthorize(SqlLifecycle.java:220) ~[druid-sql-0.15.1-incubating.jar:0.15.1-incubating]

at org.apache.druid.sql.http.SqlResource.doPost(SqlResource.java:91) [druid-sql-0.15.1-incubating.jar:0.15.1-incubating]

at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]

at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) [jersey-server-1.19.3.jar:1.19.3]

at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) [jersey-servlet-1.19.3.jar:1.19.3]

at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558) [jersey-servlet-1.19.3.jar:1.19.3]

at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733) [jersey-servlet-1.19.3.jar:1.19.3]

at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]

at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286) [guice-servlet-4.1.0.jar:?]

at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276) [guice-servlet-4.1.0.jar:?]

at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181) [guice-servlet-4.1.0.jar:?]

at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) [guice-servlet-4.1.0.jar:?]

at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85) [guice-servlet-4.1.0.jar:?]

at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) [guice-servlet-4.1.0.jar:?]

at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135) [guice-servlet-4.1.0.jar:?]

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) [jetty-servlet-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.apache.druid.server.security.PreResponseAuthorizationCheckFilter.doFilter(PreResponseAuthorizationCheckFilter.java:82) [druid-server-0.15.1-incubating.jar:0.15.1-incubating]

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) [jetty-servlet-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.apache.druid.server.security.AllowOptionsResourceFilter.doFilter(AllowOptionsResourceFilter.java:75) [druid-server-0.15.1-incubating.jar:0.15.1-incubating]

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) [jetty-servlet-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.apache.druid.server.security.AllowAllAuthenticator$1.doFilter(AllowAllAuthenticator.java:84) [druid-server-0.15.1-incubating.jar:0.15.1-incubating]

at org.apache.druid.server.security.AuthenticationWrappingFilter.doFilter(AuthenticationWrappingFilter.java:59) [druid-server-0.15.1-incubating.jar:0.15.1-incubating]

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) [jetty-servlet-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.apache.druid.server.security.SecuritySanityCheckFilter.doFilter(SecuritySanityCheckFilter.java:86) [druid-server-0.15.1-incubating.jar:0.15.1-incubating]

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) [jetty-servlet-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) [jetty-servlet-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) [jetty-servlet-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:724) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:61) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.Server.handle(Server.java:531) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) [jetty-server-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) [jetty-io-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) [jetty-io-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) [jetty-io-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) [jetty-util-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) [jetty-util-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) [jetty-util-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) [jetty-util-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) [jetty-util-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760) [jetty-util-9.4.10.v20180503.jar:9.4.10.v20180503]

at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678) [jetty-util-9.4.10.v20180503.jar:9.4.10.v20180503]

at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

2019-11-08T07:03:48,108 INFO [ServerInventoryView-0] org.apache.druid.client.BatchServerInventoryView - Server Disappeared[DruidServerMetadata{name=‘ecs-xsda-dev-0003:8100’, hostAndPort=‘ecs-xsda-dev-0003:8100’, hostAndTlsPort=‘null’, maxSize=0, tier=’_default_tier’, type=indexer-executor, priority=0}]

2019-11-08T07:04:31,304 INFO [DruidSchema-Cache-0] org.apache.druid.sql.calcite.schema.DruidSchema - Refreshed metadata for dataSource[Parking] in 6 ms (1 segments queried, 0 segments left).

I see server disappeared at the end of the log. Is your historical server up?

vijay

YEAH,the broker server runs fine.I can query any other requests expect this.

vijay narayanan vnarayaj@gmail.com于2019年11月8日 周五15:24写道:

Could you do Tail -f < on broker log > ?

And run the query and attach the error the comple log for the query .

I see in the screenshot it says unable to buld the plan for [select * from (select * … )].

Thanks ,

Vaibhav

Hi Michael,

Druid doesn’t currently support ORDER BY without a GROUP BY clause, unless it’s ORDER BY __time. The error message could definitely be improved.

Wow,thanks for your reply.:smiley:Druid will be more and more popular by your effort.