Yuyaoo opened a new issue, #13343: URL: https://github.com/apache/pinot/issues/13343
## Overview I am observing an issue with the `arrayagg` function in queries. Specifically, when a column contains empty data, the `arrayagg` function triggers a Null Pointer Exception. ## Details For example, the following query results in NPE if `accountId` has empty results: ```select arrayagg(accountId,'STRING',true) from table123 where accountId in (12345)``` However, if ensuring the where clause for `accountId` has non-empty results, the query is successful. In [AggregationDataTableReducer.java](https://github.com/apache/pinot/blob/1e0dc300f9c0dde301a985c8b44ce4b4119526df/pinot-core/src/main/java/org/apache/pinot/core/query/reduce/AggregationDataTableReducer.java#L113) in the pinot-core query service, I suspect the intermediateResults is empty on this line, causing the NPE. ## Stack Trace ``` Caused by: java.lang.NullPointerException at it.unimi.dsi.fastutil.longs.LongArrayList.<init>(LongArrayList.java:132) ~[it.unimi.dsi.fastutil-8.5.13.jar:?] at org.apache.pinot.core.query.aggregation.function.array.BaseArrayAggLongFunction.extractFinalResult(BaseArrayAggLongFunction.java:99) ~[org.apache.pinot.pinot-core-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.core.query.aggregation.function.array.BaseArrayAggLongFunction.extractFinalResult(BaseArrayAggLongFunction.java:30) ~[org.apache.pinot.pinot-core-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.core.query.reduce.AggregationDataTableReducer.reduceWithIntermediateResult(AggregationDataTableReducer.java:110) ~[org.apache.pinot.pinot-core-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.core.query.reduce.AggregationDataTableReducer.reduceAndSetResults(AggregationDataTableReducer.java:73) ~[org.apache.pinot.pinot-core-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.core.query.reduce.BrokerReduceService.reduceOnDataTable(BrokerReduceService.java:158) ~[org.apache.pinot.pinot-core-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.broker.requesthandler.SingleConnectionBrokerRequestHandler.processBrokerRequest(SingleConnectionBrokerRequestHandler.java:151) ~[org.apache.pinot.pinot-broker-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:792) ~[org.apache.pinot.pinot-broker-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.broker.requesthandler.BaseBrokerRequestHandler.handleRequest(BaseBrokerRequestHandler.java:290) ~[org.apache.pinot.pinot-broker-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.broker.requesthandler.BrokerRequestHandlerDelegate.handleRequest(BrokerRequestHandlerDelegate.java:104) ~[org.apache.pinot.pinot-broker-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at org.apache.pinot.broker.requesthandler.BrokerRequestHandler.handleRequest(BrokerRequestHandler.java:48) ~[org.apache.pinot.pinot-broker-1.2.0-dev-1354.jar:1.2.0-dev-1354-e07b576797e2dc834a60d8ee0da5d26a0b597e23] at com.linkedin.pinot.v2.broker.impl.rest.PinotServiceProxy.sendQueryRaw(PinotServiceProxy.java:312) ~[pinot-broker-impl-0.2.1163.jar:?] at com.linkedin.pinot.v2.broker.impl.rest.PinotServiceProxy.sendQuery(PinotServiceProxy.java:126) ~[pinot-broker-impl-0.2.1163.jar:?] at com.linkedin.pinot.v2.broker.impl.rest.QueryResource.getQueryResponse(QueryResource.java:92) ~[pinot-broker-impl-0.2.1163.jar:?] at com.linkedin.pinot.v2.broker.impl.rest.QueryResource.getQueryResponse(QueryResource.java:60) ~[pinot-broker-impl-0.2.1163.jar:?] at jdk.internal.reflect.GeneratedMethodAccessor159.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at com.linkedin.restli.internal.server.RestLiMethodInvoker.doInvoke(RestLiMethodInvoker.java:143) ~[restli-server-29.0.1.jar:?] at com.linkedin.restli.internal.server.RestLiMethodInvoker.invoke(RestLiMethodInvoker.java:333) ~[restli-server-29.0.1.jar:?] at com.linkedin.restli.internal.server.filter.FilterChainDispatcherImpl.onRequestSuccess(FilterChainDispatcherImpl.java:47) ~[restli-server-29.0.1.jar:?] at com.linkedin.restli.internal.server.filter.RestLiFilterChainIterator.onRequest(RestLiFilterChainIterator.java:86) ~[restli-server-29.0.1.jar:?] at com.linkedin.restli.internal.server.filter.RestLiFilterChainIterator.lambda$onRequest$0(RestLiFilterChainIterator.java:73) ~[restli-server-29.0.1.jar:?] at java.util.concurrent.CompletableFuture.uniAcceptNow(CompletableFuture.java:753) ~[?:?] at java.util.concurrent.CompletableFuture.uniAcceptStage(CompletableFuture.java:731) ~[?:?] at java.util.concurrent.CompletableFuture.thenAccept(CompletableFuture.java:2108) ~[?:?] ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org