You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/11/10 21:15:03 UTC
[GitHub] [incubator-pinot] chundongwang opened a new issue #6253: NullPointerException is thrown when query with aggregation on top of groovy functions
chundongwang opened a new issue #6253:
URL: https://github.com/apache/incubator-pinot/issues/6253
I’m getting `NPE` in `GroupByOrderByCombineOperator.getNextBlock` when the query does aggregation on top of groovy function, no matter which column I group-by with (eg dimension, datetime), or what aggregation function I use (eg AVG, SUM). The query would look like,
```sql
select
country_code,
avg(groovy('{"returnType":"DOUBLE","isSingleValue":true}', 'arg0 > arg1 ? arg0 : arg1', subtotal, total)) as average_rev
from orders
group by country_code
limit 10
```
Without `group by`, aforementioned `groovy` function works fine with enough records.
### Expected results
Expect aggreation on top of transform would work for groovy just like other transform function like `ADD` or `SUB`
### Actual results
NPE thrown as,
```log
QueryExecutionError:
java.lang.NullPointerException
at org.apache.pinot.core.operator.combine.GroupByOrderByCombineOperator.getNextBlock(GroupByOrderByCombineOperator.java:215)
at org.apache.pinot.core.operator.combine.GroupByOrderByCombineOperator.getNextBlock(GroupByOrderByCombineOperator.java:62)
at org.apache.pinot.core.operator.BaseOperator.nextBlock(BaseOperator.java:49)
at org.apache.pinot.core.operator.InstanceResponseOperator.getNextBlock(InstanceResponseOperator.java:37)
at org.apache.pinot.core.operator.InstanceResponseOperator.getNextBlock(InstanceResponseOperator.java:26)
at org.apache.pinot.core.operator.BaseOperator.nextBlock(BaseOperator.java:49)
at org.apache.pinot.core.plan.GlobalPlanImplV0.execute(GlobalPlanImplV0.java:48)
at org.apache.pinot.core.query.executor.ServerQueryExecutorV1Impl.processQuery(ServerQueryExecutorV1Impl.java:221)
at org.apache.pinot.core.query.scheduler.QueryScheduler.processQueryAndSerialize(QueryScheduler.java:155)
at org.apache.pinot.core.query.scheduler.QueryScheduler.lambda$createQueryFutureTask$0(QueryScheduler.java:139)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at shaded.com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
at shaded.com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [incubator-pinot] chundongwang commented on issue #6253: NullPointerException is thrown when query with aggregation on top of groovy functions
Posted by GitBox <gi...@apache.org>.
chundongwang commented on issue #6253:
URL: https://github.com/apache/incubator-pinot/issues/6253#issuecomment-725070465
With the help from @npawar (thanks!), I got it to work. So to sum up,
1. Aggregation functions like `Avg`/`Sum`/`PercentileTDigest##` would all require `double` so need to convert the groovy return to be `double`, which means all possible return values should be cast to `double` (eg using `column_name.toDouble()`) ;
2. I have a number literal, `0.0`, in the query which I assumed to make it double. Actually that became a `BigDecimal` and cause issue. So instead I used 0d and second exception is gone.
3. More exception could be found on server log, not broker log.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org