Hello,
I am working at a UI view that provides stats (includes count, min, max, avg...) of a specific metric for all the digital twin entities in a network. I need to average the metric for each entity given a time window and calculate the above mentioned stats.
When I run the query I get an exception (see below) and when I try running the same query in the console, I get a "Failed : HTTP error code : 500. Root Cause: Nested query is not supported without gapfill"
How do I introduce the GapFill function and time aspect of the function? I mostly want to do an average of an average.
I appreciate some insight from the community.
Thanks,
SOLUTION: I managed to fix this without using the GapFill and using multi-stage.
Query:
select count(aggregate),
min(aggregate),
max(aggregate),
percentile50(aggregate) as median,
avg(aggregate) as mean,
stddev_pop(aggregate) as stddev,
percentile(aggregate, 25) as q1,
percentile(aggregate, 75) as q3
from (
select avg(value) as aggregate
from WSHA_DERIVED_KPI_DATA
group by "entity-id"
)
LIMIT 1000000
Exception:
Caused by: java.sql.SQLException: Failed to execute query : select count(aggregate),min(aggregate),max(aggregate),percentile50(aggregate) as median,avg(aggregate) as mean,stddev_pop(aggregate) as stddev,percentile(aggregate, 25) as q1, percentile(aggregate,75) as q3 from (select avg(value) as aggregate from WSHA_DERIVED_KPI_DATA group by "entity-id") LIMIT 1000000
2025-02-05T002309.353448648Z at org.apache.pinot.client.PinotStatement.executeQuery(PinotStatement.java:75)
2025-02-05T002309.353664684Z at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:453)
2025-02-05T002309.353696243Z at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:383)
2025-02-05T002309.353704799Z ... 131 common frames omitted
2025-02-05T002309.353914734Z Caused by: org.apache.pinot.client.PinotClientException: java.util.concurrent.ExecutionException: org.apache.pinot.client.PinotClientException: Pinot returned HTTP status 500, expected 200
2025-02-05T002309.354067100Z at org.apache.pinot.client.JsonAsyncHttpPinotClientTransport.executeQuery(JsonAsyncHttpPinotClientTransport.java:101)
2025-02-05T002309.354085074Z at org.apache.pinot.client.Connection.execute(Connection.java:101)
2025-02-05T002309.354237620Z at org.apache.pinot.client.Connection.execute(Connection.java:83)
2025-02-05T002309.354246176Z at org.apache.pinot.client.PinotStatement.executeQuery(PinotStatement.java:67)
2025-02-05T002309.354252017Z ... 133 common frames omitted
2025-02-05T002309.354584061Z Caused by: java.util.concurrent.ExecutionException: org.apache.pinot.client.PinotClientException: Pinot returned HTTP status 500, expected 200
2025-02-05T002309.354594330Z at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
2025-02-05T002309.354600292Z at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
2025-02-05T002309.354699879Z at org.apache.pinot.client.JsonAsyncHttpPinotClientTransport.executeQuery(JsonAsyncHttpPinotClientTransport.java:99)
2025-02-05T002309.354708204Z ... 136 common frames omitted
2025-02-05T002309.354860921Z Caused by: org.apache.pinot.client.PinotClientException: Pinot returned HTTP status 500, expected 200
2025-02-05T002309.355089521Z at org.apache.pinot.client.JsonAsyncHttpPinotClientTransport.lambda$executeQueryAsync$1(JsonAsyncHttpPinotClientTransport.java:127)
2025-02-05T002309.355098688Z at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
2025-02-05T002309.355106803Z at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
2025-02-05T002309.355351623Z at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
2025-02-05T002309.355367984Z at org.asynchttpclient.netty.NettyResponseFuture.loadContent(NettyResponseFuture.java:222)
2025-02-05T002309.355518086Z at org.asynchttpclient.netty.NettyResponseFuture.done(NettyResponseFuture.java:257)
2025-02-05T002309.355526622Z at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.finishUpdate(AsyncHttpClientHandler.java:241)
2025-02-05T002309.355808892Z at org.asynchttpclient.netty.handler.HttpHandler.handleChunk(HttpHandler.java:113)
2025-02-05T002309.355830352Z at org.asynchttpclient.netty.handler.HttpHandler.handleRead(HttpHandler.java:142)
2025-02-05T002309.355836674Z at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.channelRead(AsyncHttpClientHandler.java:78)
2025-02-05T002309.355989762Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
2025-02-05T002309.356087475Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2025-02-05T002309.356444276Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
2025-02-05T002309.356468080Z at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
2025-02-05T002309.356474893Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
2025-02-05T002309.356481476Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2025-02-05T002309.356733198Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
2025-02-05T002309.356751062Z at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
2025-02-05T002309.356788613Z at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
2025-02-05T002309.356914539Z at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
2025-02-05T002309.357090620Z at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
2025-02-05T002309.357120606Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
2025-02-05T002309.357217238Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2025-02-05T002309.357378511Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
2025-02-05T002309.357393859Z at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
2025-02-05T002309.357555062Z at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1338)
2025-02-05T002309.357586291Z at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1387)
2025-02-05T002309.357697139Z at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530)
2025-02-05T002309.357897225Z at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
2025-02-05T002309.357919206Z at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
2025-02-05T002309.357925899Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
2025-02-05T002309.358160169Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2025-02-05T002309.358174766Z at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
2025-02-05T002309.358368440Z at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
2025-02-05T002309.358583695Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
2025-02-05T002309.358613771Z at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
2025-02-05T002309.358775605Z at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
2025-02-05T002309.358799640Z at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
2025-02-05T002309.358808116Z at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
2025-02-05T002309.358929845Z at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
2025-02-05T002309.358942158Z at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
2025-02-05T002309.359091599Z at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
2025-02-05T002309.359185255Z at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
2025-02-05T002309.359287487Z at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2025-02-05T002309.359403625Z at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2025-02-05T002309.359421308Z ... 1 common frames omitted